MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Use Manual page 7

Table of Contents

Advertisement

To use the CFC resource in your Flex Builder 2 project:
For each Flex Builder 2 project, set the Flex compiler property by doing the following:
1.
Select Project > Properties.
a.
Select the Flex complier option.
b.
Enter the following in the Additional Compiler Argument text box:
c.
--services=C:\CFusionMX7\wwwroot\WEB-INF\flex\services-config.xml
In the mxml file, you use the
2.
resource. With this connection you can call any remote method on the CFC.
Use the destination attribute of the
3.
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)"/>
Call a CFC method, for example, as the following example shows:
4.
<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 return result of the CFC method call for the
5.
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));
}
<mx:RemoteObject>
<mx:RemoteObbject>
tag to connect to your CFC named
tag to point to the name that
<mx:RemoteObject>
Using Flash Remoting Update
7

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents