Right now I am using httpPostRequest to communicate to my rails server. I was wondering if this is the best way to do this. Would using externalinterface call with a jquery post be faster? Right now I am doing something like this:
var httpUploadRequest:HTTPService = new HTTPService();
httpUploadRequest.url = serverPostUrl;
httpUploadRequest.method = "POST";
// set up post parameters
var parameters:Array = new Array();
parameters = postParameters;
httpUploadRequest.addEventListener("result", function(event:ResultEvent):void {
//success function call
});
httpUploadRequest.addEventListener("fault", function(event:FaultEvent):void {
//post fail function call
});
httpUploadRequest.send(parameters);
To the point, what is the best way to communicate between actionscript and rails: httpService, externaliInterfaceCall, or some other method? If other, please explain.
Thanks
A direct HTTP request from Flash will be quicker than ExternalInterface to jQuery. The jQuery connection will end up doing the same type of HTTP request as Flash, but with extra intermediary steps. Also, if you weren’t careful, you might create unnecessary pauses in your application as ExternalInterface calls are synchronous.
Depending on your backend, you might find a speed increase by using Flash Remoting, but not necessarily. It really depends on the type of server side activity you are using.