Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Supporting Technologies > Flash Remoting

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-09-2004, 11:53 AM   #1
andremedeiros
Registered User
 
Join Date: Oct 2004
Location: Portugal
Posts: 1
Send a message via MSN to andremedeiros
Default Flash Remoting for Flash MX 2004 Problems

I'm trying to install Flash Remoting, but I'm not having success. I've downloaded the AS 2.0 components and the source code, as described on Macromedia's website, but when I try to run the examples I found on the web, they won't work.

import mx.remoting.*; throws an error and #include "NetServices.as" says file not found.

Are there any tweaks or something I must do? I have the files, I can see them, and I tried adding the directories to the AS 2.0 Path on the preferences dialog, and still no luck...

Ideas anyone?

Thanks in advance,
André Medeiros
andremedeiros is offline   Reply With Quote
Old 11-16-2004, 09:53 PM   #2
whiterabbit
Registered User
 
Join Date: Oct 2001
Location: Miami
Posts: 4
Default

Im having the same problem. I think its because I am using 2004 and the names of the classes have changed as well as the syntax.

In your Flash menu navigate to Windows/Other Panels/Common Libraries/Remoting and you will see the classes.

I Tried import instead of include but still was not working. Would sure like to see a tutorial on AMFPHP updated for 2004
whiterabbit is offline   Reply With Quote
Old 12-06-2004, 04:57 AM   #3
maular
Registered User
 
Join Date: Dec 2004
Posts: 2
Default

The simplest solution is just to install the Flash Remoting Components for Actionscript 1.0 (if that's what you are familiar with), and the tutorial will work fine.

These are available for download from the same Macromedia page (http://www.macromedia.com/software/f...ds/components/).


edit: and looking a couple of posts down, olioskar has given the link http://www.flashant.org/index.php?p=66&c=1 which says you need to drag a Remoting component to your movie before that'll work, or download the remoting components source from the macromedia link above.

Last edited by maular; 12-06-2004 at 05:02 AM..
maular is offline   Reply With Quote
Old 04-06-2005, 04:36 PM   #4
hobbis
Senior Member
 
hobbis's Avatar
 
Join Date: May 2002
Location: Faversham, Kent
Posts: 285
Default

Did anyone ever figure this out? I have just downloaded the AS 2.0 version which I would prefer to use and nothing works. I have installed the AS 2.0 components too. I guess I need to import the files instead of #include but documentation is scarce.
hobbis is offline   Reply With Quote
Old 04-06-2005, 05:05 PM   #5
snapple
member
 
snapple's Avatar
 
Join Date: Feb 2002
Location: London
Posts: 2,413
Send a message via MSN to snapple
Default

Don't bother...use version 1 components.

Regards, snapple
snapple is offline   Reply With Quote
Old 04-07-2005, 09:05 AM   #6
hobbis
Senior Member
 
hobbis's Avatar
 
Join Date: May 2002
Location: Faversham, Kent
Posts: 285
Default

Thanks Snapple. Could you tell me why you think I should stick to AS 1.0? I must admit, I've got it working in this version (AS1.0) which is a relief but I want to go down the AS 2.0 route. It seems when you install the latest components, it does not put anything in the include folder, so most examples using amfphp will fail.
hobbis is offline   Reply With Quote
Old 04-07-2005, 09:08 AM   #7
snapple
member
 
snapple's Avatar
 
Join Date: Feb 2002
Location: London
Posts: 2,413
Send a message via MSN to snapple
Default

When you say "go down the AS 2.0" route, do you mean, the actionscript inside your fla? Because you can still write strictly typed actionscript using version 1 components. Your absolutely right about version 2.0 components not installing the relavent classes. Don't ask me why...i don't know much about remoting.

Regards, snapple
snapple is offline   Reply With Quote
Old 04-07-2005, 10:05 AM   #8
hobbis
Senior Member
 
hobbis's Avatar
 
Join Date: May 2002
Location: Faversham, Kent
Posts: 285
Default

Ok, this is what I've discovered so far - forget the components, generally I avoid them like the plague anyway. Downloaded the classes source code and put them in the right places:

http://www.macromedia.com/software/f...ds/components/
At this time the file is called: flashremoting_comp_sourcecode.zip

I have just installed an AS 2.0 HelloWorld and AMFPHP example and it works...

so far so good. Next stage database stuff. I reckon I'll be going nuts later today but I'll keep at it. Cheers.
hobbis is offline   Reply With Quote
Old 04-08-2005, 12:28 PM   #9
hobbis
Senior Member
 
hobbis's Avatar
 
Join Date: May 2002
Location: Faversham, Kent
Posts: 285
Default

For the benefit of the newcomers to Flash Remoting and AS2.0. I have written an example on how to create an AS2.0 version of a MySQL connection/RecordSet implementation:

the PHP:

Code:
    class GrabData {

        var $dbhost = "localhost";
        var $dbname = "databasename";
        var $dbuser = "generic_webuser";
        var $dbpass = "generic_webuser";
    
        function GrabData() {
            $this->methodTable = array(
                "getFLV" => array(
                    "description" => "Returns recordset",
                    "access" => "remote",
					"arguments" => array ("arg1")
                )
            );

            // Initialize db connection

            $this->conn = mysql_pconnect($this->dbhost, $this->dbuser, $this->dbpass);
            mysql_select_db ($this->dbname);
        }
        
        function getFLV($id) {
            return mysql_query("SELECT * FROM flvs WHERE id=" . $id);
        }
    }
The ActionScript:

Code:
 /*
* You can just use:
* import mx.remoting.*
* import  mx.remoting.rpc.*
* but I prefer to explicitly refer to classes needed
* */

import mx.remoting.Service;
import mx.remoting.RecordSet;
import mx.services.Log;
import mx.remoting.PendingCall;;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.debug.NetDebug;

class webvu.cms.remoting.GrabData
{
	private var myService:Service
	private var show:TextField
	private var timeline:MovieClip //reference to the timeline
	private var init:Boolean
	private var  myLogger:Log
	
	//Constructor
	public function GrabData(timeline){
		NetDebug.initialize()
		 myLogger = new Log(Log.DEBUG, "logger1");
		myService = new Service("http://yourUurlHere/cms/website/gateway.php", myLogger,"GrabData",null,null);		
		this.timeline = timeline
	}

	//Public methods
	public function getFLV(id:Number):Void {
		var pc:PendingCall = myService.getFLV(id)
		pc.responder = new RelayResponder(this, "getFLV_onResult", "getFLV_onFault" );
	}

	//Private methods
	private function getFLV_onResult(res:ResultEvent):Void{
		NetDebug.trace( { level: "debug", message: "There's a result: "})		
		timeline.show.text = res.result.getLength() + " " +  res.result.items[0].file;
	}

	private function getFLV_onFault(e:FaultEvent):Void{		
		NetDebug.trace( { level: "debug", message: "There was a problem: " + e.fault.faultstring})
	}
}
for this test I had a very simple database with one table and two columns set up:

Columns: 'id' and 'file'


I realise most of you here will see this as basic stuff but when I started remoting in AS2.0, I couldn't find anything like this.

Hope this helps somebody!
hobbis is offline   Reply With Quote
Old 05-12-2005, 09:59 AM   #10
johnw
Registered User
 
Join Date: May 2005
Posts: 1
Default

To use the AS2.0 version you need to do (once you have installed the remoting AS 2.0 components):

Window Menu > Other Panels > Common Libraries > Remoting

Then drag the RemotingClasses on the stage of your movie. You can delete it off the stage and it will stay in your library.

The RemotingDebugClasses is for debugging during testing. You may want to remove this from your library when you go to production to reduce the file size.

Hope that helps!
johnw is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:51 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.