Adobe COLDFUSION 9 Manual page 696

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
Coding the ColdFusion query and HTTP operations in ActionScript is very straightforward. The
functions provide a well-defined interface for building SQL queries and HTTP operations.
CF.http
For example, the following is a typical server-side ActionScript function definition that returns query data:
// This function shows a basic CF.query operation using only
// arguments for data source name and for SQL.
function basicQuery()
{
mydata = CF.query({datasource:"customers",
sql:"SELECT * FROM myTable"});
return mydata;
}
What to do next
If you are already familiar with ActionScript, here a few things to get you started:
• How to establish a connection with the Flash Remoting service using client-side ActionScript. See
the Flash Remoting
service" on page 691
• How to reference server-side ActionScript functions and methods. See
on page 692.
• How to code the server-side
"Using the CF.http
function" on page 700. Also see the reference pages for these functions in the CFML Reference.
For additional information on using Flash Remoting, see
Flash Remoting.
Connecting to the Flash Remoting service
Before you can use functions defined in your server-side ActionScript files, connect the Adobe SWF movie to the
server-side Flash Remoting service.
Create a Flash Remoting service connection
Include the necessary ActionScript classes in the first frame of the SWF movie that uses server-side ActionScript
1
functions.
Use the following command to include the
a
#include "NetServices.as"
(Optional) Use the following command to include the
b
#include "NetDebug.as"
For more information about the
2
Since the Flash Remoting service serves as a broker for calls to server-side ActionScript functions, identify the Flash
Remoting service URL as an argument in the
NetServices.setDefaultGatewayURL("http://localhost:8500/flashservices")
Specify a server host name. The default port number for the Flash Remoting service is 8500.
3
Create the gateway connection using the
gatewayConnection = NetServices.createGatewayConnection();
and
functions. See
CF.query
CF.http
"Using the Flash Remoting
NetServices
and
NetDebug
RecordSet
NetServices.setDefaultGatewayUrl
NetServices.createGatewayConnection
Last updated 8/5/2010
"Using server-side ActionScript
"Using the CF.query
Service" on page 606 and Using
class:
class:
NetDebug
classes, see Using Flash Remoting.
and
CF.query
"Connecting to
functions"
function" on page 694 and
function. For example:
function; for example:
691

Advertisement

Table of Contents
loading

Table of Contents