I ran across a problem today trying to define a RemoteObject (mx.rpc.remoting.mxml.RemoteObject) in ActionScript instead of a services-config.xml file.
It seems like it would be fairly straightforward
var myRo:RemoteObject = new RemoteObject(); myRo.source = "amf_tests.HelloWorld"; myRo.destination = "amfphp"; myRo.endpoint = "/amfphp/gateway.php";
but, alas, I found that endpoint isn’t a property, though it looks like it might be in the future. It isn’t even a readily accessible class. You need to build a channelset, add a channel, and then pass a url (and id) to the channel to specify the endpoint. Something like this:
myRo.channelSet(new ChannelSet().addChannel(new AMFChannel("my_amfphp", "/amfphp/gateway.php")));
The above is equivalent to the following services-config.xml (I think):
<?xml version="1.0" encoding="UTF-8"?> <services-config> <services> <service id="amfphp-flashremoting-service" class="flex.messaging.services.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage"> <destination id="amfphp"> <channels> <channel ref="my_amfphp"/> </channels> <properties> <source>*</source> </properties> </destination> </service> </services> <channels> <channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel"> <endpoint uri="/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/> </channel-definition> <channels> </services-config>
This explains it better than me.
It looks like you can get by with setting ro.endpoint and not messing with the channels. Don’t know what wasn’t working for me before.