How do I call a RemoteObject method from ActionScript?

回眸只為那壹抹淺笑 提交于 2019-12-24 23:19:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!