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

108 Chapter 6: Using Flash Remoting with ColdFusion MX
The following example replicates the helloWorld() function that was previously implemented as
a ColdFusion page. For more information, see “Using Flash Remoting with ColdFusion pages”
on page 97.
To create a ColdFusion component that interacts with a Flash application:
1.
Create a ColdFusion component, and save it as flashComponent.cfc in the helloExamples
directory.
2.
Edit flashComponent.cfc so that it appears as follows:
<cfcomponent>
<cffunction name="helloWorld" access="remote" returnType="Struct">
<cfset tempStruct = StructNew()>
<cfset tempStruct.timeVar = DateFormat(Now ())>
<cfset tempStruct.helloMessage = "Hello World">
<cfreturn tempStruct>
</cffunction>
</cfcomponent>
This example creates the helloWorld function. The cfreturn tag returns the result to the
Flash application.
3.
Save the file.
The following ActionScript example calls this function:
import mx.remoting.Service;
import mx.remoting.PendingCall;
//…
var CFCService:Service = new Service(
"http://localhost/flashservices/gateway",
null,
"helloExamples.flashComponent",
null,
null);
var pc:PendingCall = CFCService.helloWorld();
For ColdFusion components, the component filename, including the directory structure from the
web root, serves as the service name. Remember to use a period to delimit the path directories,
rather than a backslash.
Accessing ActionScript objects
ActionScript supports the object initializer syntax when calling a function. For example, the
following function call passes two parameters as objects:
myService.myMethod({x:1, y:2});
In this example, the function passes x with a value of 1 and y with a value of 2.
In your component, you can access objects using the object name, as in the following example:
<cfcomponent>
<cffunction ...>
<cfargument name="x" type="numeric">
<cfargument name="y" type="numeric">