Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 704

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
Checking for a Flash Remoting service connection
To ensure that the SWF movie is connected to the Flash Remoting service, you use an
if (inited == null)
{
inited = true;
NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/
gateway");
gateway_conn = NetServices.createGatewayConnection();
directoryService = gateway_conn.getService(personneldirectory, this);
status.text = "Type into the text boxes, then click 'Search'";
}
In this example, the
inited
the Flash Remoting service using the NetServices object. For more information about connecting to the Flash
Remoting service, see
"Connecting to the Flash Remoting
About the CF.http function
You use the
ActionScript function to retrieve information from a remote HTTP server using HTTP
CF.http
methods, as follows:
Post
• Using the
method, you send information to the remote server directly in the URL. This method is common for
Get
a one-way transaction in which the
• The
method can pass variables to a form or CGI program, and can also create HTTP cookies.
Post
The most basic way to use the
specified URL. The
method is the default for the
Get
The following server-side example retrieves file content from the specified URL:
function basicGet(url)
{
// Invoke with just the url argument. This is an HTTP GET.
result = CF.http(url);
return result.get("Filecontent");
}
The client-side example could look like the following:
#include "NetServices.as"
NetServices.setDefaultGatewayUrl("http://mycfserver:8500");
gatewayConnnection = NetServices.createGatewayConnection();
myHttp = gatewayConnnection.getService("httpFuncs", this);
// This is the server-side function invocation
url = "http://anyserver.com";
myHttp.basicGet(url);
// Create the results function
function basicGet_Result()
{
url = "http://anyserver.com
ssasFile.basicGet(url)
}
variable is evaluated for a value. If
function retrieves an object, such as the contents of a web page.
CF.http
function is to use it with the
CF.http
CF.http
Last updated 1/20/2012
is
(not connected), the movie connects to
inited
null
service" on page 691.
method argument to retrieve a page from a
Get
function.
statement; for example:
if
and
Get
699

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents