Adobe COLDFUSION 9 Manual page 702

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
3
Define a search function that sends user data to the Flash Remoting service. See
Remoting
service" on page 697.
Define a result function that captures the results returned from the Flash Remoting service. See
4
Remoting service
results" on page 698.
Ensure that the SWF movie has established a connection to the Flash Remoting service. See
5
Remoting service
connection" on page 699.
Writing the server-side ActionScript function
The example here creates a search function that performs a simple search operation against a ColdFusion data source.
This function accepts two arguments, firstName and lastName, and returns any records found that match these
arguments.
Create a server-side ActionScript function
Create a server-side ActionScript file that contains the following code:
//search takes firstName lastName arguments
function search(firstName, lastName)
{
searchdata = CF.query({datasource: "bigDSN",
sql:"SELECT * from personnel WHERE fname = firstName AND lname = lastName"{);
if (searchdata)
return searchdata;
else
return null;
}
Creating the SWF movie interface
The SWF movie interface example here consists of one frame with a variety of text boxes and a submit button.
In the Flash authoring environment, create a Flash source file, and save it as pDirectory.fla.
1
2
Create two input text boxes. Name one text box variable lastName and the other firstName.
Create a dynamic text box, and name its variable status.
3
Insert a list box component, and name it dataView.
4
5
Insert a push-button component.
Save your work.
6
Submitting user data to the Flash Remoting service
To send data to server-side ActionScript, create a function that passes the data from the SWF movie to server-side
ActionScript. The
function, applied at the frame level, collects the user-entered data from the firstName and
search
lastName text boxes and passes the data as function arguments to the directoryService object, which is created when
the SWF movie connects to the Flash Remoting service. For more information, see
service
connection" on page 699.
The following is a Flash ActionScript example:
Last updated 8/5/2010
"Submitting user data to the Flash
"Capturing Flash
"Checking for a Flash
"Checking for a Flash Remoting
697

Advertisement

Table of Contents
loading

Table of Contents