Navneet Behal wrote:
"Binary" is the operating word JOR. This makes remoting calls far smaller in byte size and the code extremely portable. Of course, since the filesize is smaller, there is a speed benefit as well. And the beauty of Remoting is that data exchange is done independent of the language, while it still remains native to the program. What that means is that if you pass an array from Flash to let's say PHP, PHP will recieve the array in its own native array format. And then if PHP returns an associative array for example, Flash will recieve it as a Flash Object! This saves you from having to deserialize or parse your xml object. Your code and life become easier :)

Flash remoting works with an inbuilt Flash Player Object called NetConnection which allows you to exchange data with the server in a binary format called Action Message Format (AMF). The serialization in this format is done automatically via the NetConnection object. Your recieving application should know how to deserialize it. The deserialization should be abstracted in a generic way and that is what projects like AMFPHP or other Remoting solutions for .NET, Java or ColdFusion do.

MM has made remoting into some complex mysterious thing by writing esoteric actionscript classes but at the core Remoting is just this:

------------------------------------------------
var nc:NetConnection = new NetConnection();
nc.connect("aRemotingGatewayUrl");
nc.call("aRemoteServicePath", this);

this.onResult = function():Void{
   trace(arguments);
}

this.onError = function():Void{
   trace(arguments);
}
------------------------------------------------

This is not much different from the LoadVars or XML object where you have an onLoad method. Here you have a onResult method and an onError method which are called appropriately upon a server response.

There are solutions to deserialize the AMF format in Java, .NET, ColdFusion(of course ;) as well as PHP. For PHP the project is called AMFPHP (amfphp.org). It is extremely easy and fast to use. Once you get a hang of it, you will never want exchange data any other way with your server :)

XML exchange is basically still a text based stream and taxes your code and your player.

Imagine a world where there is no need for parsing/deserializing data. Just exchange information with the server and display. That's remoting for you :)

Good Luck
Navneet




Thanks. With all of this positve feedback from the members of this list, I'm going to start exploring the options and implications of updating one or more of my projects over to remoting!

Thanks again,
JOR


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to