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

116 Chapter 6: Using Flash Remoting with ColdFusion MX
To handle the results of the web service method, you create an event handler with the same name
as the service functions with
_Result or _Fault appended to the name. The result handler
displays the results in the
myGrid DataGrid component, as the following example shows:
function getCategories_Result(result:ResultEvent):Void {
// display successful result
myGrid.dataProvider = result.result;
}
function getCategories_Fault(fault:FaultEvent):Void {
message_txt.text = fault.fault.description;
}
In this example, the result of the web service function call, represented by the result.result
property, is assigned to the
dataProvider property of the DataGrid component, myGrid, which
appears in the Flash application.
Securing access to ColdFusion from Flash Remoting
You can use the ColdFusion security mechanism to control access to ColdFusion files from Flash,
just as you control access to any ColdFusion page. In this way, you can grant Flash applications
access to only selected ColdFusion code.
ColdFusion security is based on a username and password. Flash Remoting applications can pass
the user name and password information using the
setCredentials() function in ActionScript.
From within your ColdFusion Application.cfm page, you can use the
cflogin tag to access this
information.
The following example passes a user name and password to ColdFusion:
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.ResultEvent;
import mx.rpc.FaultEvent;
//…
var myService:Service = new Service(
"http://localhost/flashservices/gateway",
null,
"securityTest.thecfc",
null,
null);
myService.connection.setCredentials("myUserid", "myPassword");
Note: Typically, you do not hard-code a user name and password within a Flash application, because
SWF files can be easily decompiled.
You use the cflogin tag to retrieve the user name and password information, as the following
example Application.cfm file shows:
<cfsilent>
<cflogin>
<cfif isDefined("cflogin")