Calling RemoteObject components in ActionScript
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.controls.Alert;
import mx.rpc.remoting.RemoteObject;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
[Bindable]
public var empList:Object;
public var employeeRO:RemoteObject;
public function useRemoteObject(intArg:int, strArg:String):void
{
employeeRO = new RemoteObject();
employeeRO.destination = "EmpManager";
employeeRO.getList.addEventListener("result",getListResultHandler);
employeeRO.addEventListener("fault", faultHandler);
employeeRO.getList("AAA");
}
public function getListResultHandler(event:ResultEvent):void {
empList = event.result;
}
public function faultHandler (event:FaultEvent):void {
Alert.show(event.fault.faultString, 'Error');
}
</mx:Script>
</mx:Application>
Related examples in the same category