I'll assume you're using the Flex service configuration files
1 to map your services.
In
remoting-config.xml, you'll have something like:
<destination id="DemoService">
<properties>
<source>com.me.myapp.DemoService</source>
</properties>
</destination>
If you're not already, you need to add this configuration to your
Flex compiler arguments.
-services "C:\path\to\my\services-config.xml"
Note: services-config.xml includes remoting-config.xml, there are several types of service configuration for Flex.I don't know if you're building with Ant, Flex Builder or what, but you add this argument on the mxmlc invocation of your build script or, in Flex Builder on your Project->Properties->Flex Compiler screen, in the Additional compiler arguments field.
Then a
FLVListProxy might look something like:
public class FLVListProxy extends Proxy
{
public static const NAME:String = "FLVListProxy";
public static const FLV_LIST_RETRIEVED:String = NAME+"/flvListRetrieved";
public static const FLV_LIST_FAULT:String = NAME+"/flvListFault";
private var demoService:RemoteObject;
public function FLVListProxy()
{
super(NAME, new Array());
}
override public function onRegister():void
{
demoService= new RemoteObject("DemoService");
demoService.getListOfAvailableFLVs.addEventListener( ResultEvent.RESULT, onGetListOfAvailableFLVs );
demoService.addEventListener( FaultEvent.FAULT );
}
public function getListOfAvailableFLVs():void
{
demoService.getListOfAvailableFLVs();
}
private function onGetListOfAvailableFLVs( event:ResultEvent ):void
{
flvList = event.result;
sendNotification( FLV_LIST_RETRIEVED, flvList );
}
private function onFault( event:FaultEvent ):void
{
// this handles all faults for the service, since
// the listener was placed on the service, not the method.
// you could also have separate fault handlers for
// each service method by placing the listeners on the method instead
sendNotification(FLV_LIST_FAULT, event.faultDetail );
}
public function onRemove():void
{
demoService.getListOfAvailableFLVs.removeEventListener( ResultEvent.RESULT, onGetListOfAvailableFLVs );
demoService.removeEventListener( FaultEvent.FAULT );
demoService=null;
}
public function get flvList():Array
{
return data as Array;
}
}
Hope this helps,
-=Cliff>
1 Flex docs on remoting:
http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_4.html