如何从ActionScript调用RemoteObject方法?

时间:2009-06-12 15:02:18

标签: actionscript-3

这个MXML的ActionScript等价物是什么?

<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 个答案:

答案 0 :(得分:3)

你只需要打电话:

Server.executeQuery(...);

执行后,您将在处理程序中处理结果,该结果指定为:

private function handler_fetchDataRequestSuccess(event:ResultEvent);

编辑:让我翻译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);