"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
---------------------------------------------

----- Original Message ----- From: "JOR" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Thursday, November 10, 2005 4:33 AM
Subject: Re: [Flashcoders] Remoting with AMFPHP vs. ASP


Can someone explain the difference or benefits between using Flash Remoting versus the XML object to retreive data?

I haven't used Flash remoting yet mostly because of it's price tag. The XML object has been working just fine for me. I use an XML object to load in ASP pages that make SQL queries and return XML formatted strings.

Is it that remoting is better or do each have there own place?


JOR

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

Reply via email to