User Guide
Table Of Contents
- Contents
- About Flash Remoting
- Getting Started
- Using Flash Remoting ActionScript
- Using the RemotingConnector component (Flash Professional only)
- Using Flash Remoting Data in ActionScript
- About Flash Remoting and data types
- Understanding Action Message Format
- Converting from ActionScript to application server data types
- Converting from application server data types to ActionScript
- ColdFusion to ActionScript data conversion issues
- About working with objects
- About working with RecordSet objects
- About working with XML
- The NetConnection Debugger
- Using Flash Remoting with ColdFusion MX
- Using Flash Remoting for Java
- About Flash Remoting for Java
- Calling Java classes or JavaBeans from ActionScript
- Calling Enterprise JavaBeans (EJBs) from Flash
- Calling servlets and JSPs from Flash
- Calling JMX MBeans from Flash (JRun only)
- Calling server-side ActionScript from Flash (JRun only)
- Handling function results in ActionScript
- Using Flash Remoting with JRun security
- Passing XML objects between Flash and Java
- Viewing Flash Remoting log entries
- Using Flash Remoting for Microsoft .NET
- Flash Remoting for Microsoft .NET
- Calling ASP.NET pages from Flash
- Making an ASP.NET page available to Flash Remoting
- Getting a reference to an ASPX-based service in ActionScript
- Invoking ASPX pages in ActionScript
- Using the Flash Remoting custom server control in ASPX pages
- Using the Flash Remoting namespace in code-behind files
- Using ASP.NET state management with Flash Remoting
- Using ASP.NET exception handling
- Using ADO.NET objects with Flash Remoting
- Displaying a RecordSet object in Flash with ActionScript
- Calling web services from Flash
- Calling ASP.NET assemblies from Flash
- Viewing Flash Remoting log entries
- Using NetServices and Connection Classes
- Index

Using Flash Remoting with server-side ActionScript 111
Using Flash Remoting with server-side ActionScript
The ability to create server-side ActionScript provides a familiar way for Flash developers to access
ColdFusion query and HTTP features without learning CFML. Identify the ActionScript files
(with the .asr extension) that you want to call from the Flash application and place them on the
server, anywhere under the web server’s root directory. To specify subdirectories of the web root or
a virtual directory, use package dot notation. For example, in the following assignment code, the
stockquotes.asr file is in the mydir\stock\ directory:
var stockService:Service =
gatewayConnnection.getService("mydir.stock.stockquotes", this);
You can also point to virtual mappings, such as cfsuite.asr.stock.stockquotes, where
cfsuite is a virtual mapping and asr.stock is a subdirectory of that mapping. The CF.query
and
CF.http functions give you a well-defined interface for building the SQL queries and HTTP
operations of ColdFusion.
For example, the following server-side ActionScript function definition returns a RecordSet
object:
function basicQuery()
{
var mydata = CF.query({datasource:"customers",
sql:"SELECT * FROM myTable"});
return mydata;
}
Using CF.http()
The
CF.http() ActionScript function lets you retrieve information from a remote HTTP server.
HTTP
Get and Post methods are supported. Using the Get method, you send information to
the remote server directly in the URL. This method is often used for a one-way transaction in
which the
CF.http() function retrieves an object, such as the contents of a web page. The Post
method can pass variables to a form or CGI program, and can also create HTTP cookies.
One of the most basic ways to use the
CF.http() function is with the Get method argument to
retrieve a page from a specified URL. For example, the following server-side code retrieves file
content from the specified URL:
function basicGet(url)
{
// Invoke with just the url. This is an http get.
result = CF.http(url);
return result.get("Filecontent");
}
In the client-side ActionScript, you call the service function and display the results in the Flash
application, as in the following example:
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.ResultEvent;
var myHttpService:Service = new Service(