Remotely Connect Your Flex/AIR App Without Services-Config
Many developers have the question of how to define the infamous connections to the various AMF gateways to which they need to communicate through to their server-side code. The process, while usually handled through the famed services-config.xml file, can actually be handled directly in your ActionScript very easily.
The examples below are showing connecting to a AMFPHP endpoint as opposed to a ColdFusion one, only because that is what I have been learning and working on recently. For ColdFusion, simply replace the latter part of the string with /flex2gateway/
First, define a new string in your model that references the URI to which you are going to connect with your RemoteObjects:
Then, simply define a new ChannelSet, and Channel to add to the ChannelSet that references your URI:
var customChannel:Channel = new AMFChannel("my-amfphp", endpointUri);
cs.addChannel(customChannel);
Finally, define your RemoteObject to access this ChannelSet that you just created and set the destination to the name you gave your AMFChannel:
showBusyCursor="true" />
It is as simple as that! Be sure to take out the services-config declaration in your compiler arguments to test this out appropriately.


