| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
|
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 |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Oct 2001
Location: Miami
Posts: 4
|
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 |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Dec 2004
Posts: 2
|
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.. |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: May 2002
Location: Faversham, Kent
Posts: 285
|
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.
|
|
|
|
|
|
#5 |
|
member
|
Don't bother...use version 1 components.
Regards, snapple |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: May 2002
Location: Faversham, Kent
Posts: 285
|
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.
|
|
|
|
|
|
#7 |
|
member
|
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 ![]() |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: May 2002
Location: Faversham, Kent
Posts: 285
|
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. |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: May 2002
Location: Faversham, Kent
Posts: 285
|
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);
}
}
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})
}
}
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! |
|
|
|
|
|
#10 |
|
Registered User
Join Date: May 2005
Posts: 1
|
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! |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|