.NET Invocation guide for Flash Remoting clients AS3
.NET, Flash, Flex, RIA, fluorinefx December 17th, 2007Finding examples with AS2 to do a Remote Call (Fluorine or WebORB) is easy.
However, finding an example for AS3 is very, very hard.
Here's how you do it (thanks to Ward De Langhe):
Actionscript:
-
private function getGalleryData():void{
-
-
registerClassAlias("logics.BLL.CollectionEntity",GalleryVO);
-
registerClassAlias("logics.BLL.GridRowEntity",GalleryRowVO);
-
registerClassAlias("logics.BLL.PictureEntity",GalleryImageVO);
-
-
galleryService=new NetConnection();
-
galleryService.objectEncoding=ObjectEncoding.AMF0;
-
galleryService.connect(SiteModel.GATEWAY_URL);
-
//SiteModel.GATEWAY_URL is url path to your gateway
-
responder=new Responder(galleryResult, galleryFault);
-
galleryService.call("remoting.service.CollectionService.GetCollection",responder);
-
}
-
-
private function galleryResult(result:Object):void{
-
galleryVO=result as GalleryVO;
-
}
-
-
private function galleryFault(fault:Object):void{
-
}
We haven't been able to figure aout why ObjectEncoding.AMF3 doesn't work.
Well, it works, but in the result the objects are not deserialized, so you just get Objects...
August 29th, 2008 at 6:08 pm
What about an example where a parameter is passed?
I’m really disappointed with the remoting capabilities of AS3, or at least the documentation.
October 9th, 2008 at 9:23 am
galleryService.call(“remoting.service.CollectionService.GetCollection”,responder, id);
galleryService.call(“remoting.service.CollectionService.GetCollection”,responder, id, secondId);
galleryService.call(“remoting.service.CollectionService.GetCollection”,responder, myArray1, id, myArray2, myBoolean, myString);
Contract on the server side needs to match off course!