用as实现RemoteObject

1)用as实现RemoteObject更灵活:注意下RemoteObject所属的包,还有as中还有另外一个RemoteObject类。

import mx.rpc.AsyncToken;
import mx.rpc.events.FaultEvent;
import mx.rpc.remoting.mxml.RemoteObject;

var ro:RemoteObject = new RemoteObject();
ro.destination = "Server";
ro.source = "gb.informaticasystems.Server";
ro.addEventListener( FaultEvent.FAULT, handler_backendCommunicationFails );


var query:AsyncToken = ro.executeQuery();
query.addResponder(new Responder( handler_fetchDataRequestSuccess ) );

var data:AsyncToken = ro.getData();
data.addResponder(new Responder( handler_getDataSuccess ) )

 2)还需要什么?channelset,下面的url就是你的目的地

var cs:ChannelSet = new ChannelSet();
 cs.addChannel(new AMFChannel("myAmf", "http://servname:2000  /eqa/messagebroker/amf"));
ro.channelSet = cs;
 

你可能感兴趣的:(object)