User Guide

Using Flash Remoting Update 7
To use the CFC resource in your Flex Builder 2 project:
1. For each Flex Builder 2 project, set the Flex compiler property by doing the following:
a. Select Project > Properties.
b. Select the Flex complier option.
c. Enter the following in the Additional Compiler Argument text box:
--services=C:\CFusionMX7\wwwroot\WEB-INF\flex\services-config.xml
2.
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.
3. Use the destination attribute of the <mx:RemoteObbject> tag to point to the name that
you defined in the services-config.xml file; for example:
<mx:RemoteObject
id="a_named_reference_to_use_in_mxml"
destination="CustomID"
result="my_CFC_handler(event)"/>
4.
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.
5. Specify a handler for the return result of the CFC method call for the <mx:RemoteObject>
tag, as the following example shows.
private function my_CFC_handler( event:ResultEvent )
{
// Show alert with the value that is returned from the CFC.
mx.controls.Alert.show(ObjectUtil.toString(event.result));
}