问题
What's the ActionScript equivalent of this MXML?
<mx:RemoteObject id="Server" destination="Server" source="gb.informaticasystems.Server" fault="handler_backendCommunicationFails(event)" >
<mx:method name="executeQuery" result="handler_fetchDataRequestSuccess(event)"/>
</mx:RemoteObject>
TIA!
回答1:
You just need to call:
Server.executeQuery(...);
After it executes, you handle the result in your handler, which you specified as:
private function handler_fetchDataRequestSuccess(event:ResultEvent);
EDIT: Let me translate the MXML:
var Server:RemoteObject = new RemoteObject();
Server.destination = "Server";
Server.source = "gb.informaticasystems.Server";
Server.executeQuery.addEventListener("result", handler_fetchDataRequestSuccess);
Server.executeQuery.addEventListener("fault", handler_backendCommunicationFails);
来源:https://stackoverflow.com/questions/987130/how-do-i-call-a-remoteobject-method-from-actionscript