- In the MXML file, you use the <mx:RemoteObject> tag to connect to your CFC named resource. With this connection, you can call any remote method on the CFC.
If you created a destination for the CFC in the remoting-config.xml file, specify the destination name in the mx:RemoteObjecttag; for example:
id="a_named_reference_to_use_in_mxml"
destination="CustomID"
result="my_CFC_handler(event)"/>If you did not create a destination for the CFC, specify the ColdFusion destination and the CFC path in the mx:RemoteObbjecttag; for example:
id="myCfc"
destination="ColdFusion"
source="myApplication.components.User"/>Call a CFC method, for example, as the following example shows:
<mx:Button label="reload" click="my_CFC.getUsers()"/>
In this example, when a user presses a button, the Click event calls the CFC method getUsers.
Specify a handler for the returned result of the CFC method call for the <mx:RemoteObject>tag, as the following example shows.
{
// Show alert with the value that is returned from the CFC.
mx.controls.Alert.show(ObjectUtil.toString(event.result));
}