a)創建您的遠程對象(您可以從mxml或as ):
<mx:RemoteObject id="remoteObject" destination="campaignRemoteServices">
<mx:method name="method1" result="createResult1(event)" fault="createFault1(event)"/>
<mx:method name="method2" result="createResult2(event)" fault="createFault2(event)"/>
<mx:.......
</mx:RemoteObject>
在做之前,你需要知道目的地名稱和公開的方法。
b)中配置遠程對象的信道:
var channelSet:ChannelSet = new ChannelSet();
var channel:AMFChannel = new AMFChannel("amf", "blazeds amf endpoint , for example http://localhost:8080/myapp/messagebroker/amf");
channelSet.addChannel(channel);
remoteObject.channelSet = channelSet;
c)中調用方法:
remoteObject.method1("test");