Contents > Developing ColdFusion MX Applications > Using the Flash Remoting Service > Using the Flash Remoting service with ColdFusion pages > Returning results to Flash PreviousNext

Returning results to Flash

In ColdFusion pages, only the value of Flash.Result variable is returned to the Flash application. For more information about supported data types between ColdFusion and Flash, see the data type table in Using the Flash Remoting service with ColdFusion pages. The following procedure creates the service function helloWorld, which returns a structure containing simple messages to the Flash application.

To create a ColdFusion page that passes a structure to Flash:

  1. Create a folder in your web root, and name it helloExamples.
  2. Create a ColdFusion page, and save it as helloWorld.cfm in the helloExamples directory.
  3. Modify helloWorld.cfm so that the CFML code appears as follows:
    <cfset tempStruct = StructNew()>
    <cfset tempStruct.timeVar = DateFormat(Now ())>
    <cfset tempStruct.helloMessage = "Hello World">
    
  4. In the example, two string variables are added to a structure, one with a formatted date and one with a simple message. The structure is passed back to the Flash application using the Flash.Result variable.
  5. Save the file.

Remember, the directory name is used the service address, and the helloWorld.cfm file is a method of the helloExamples Flash Remoting service. The following ActionScript example calls the helloWorld ColdFusion page:

include "NetServices.as"
NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/gateway");
gatewayConnection = NetServices.createGatewayConnection();
CFMService = gatewayConnection.getService("helloExamples", this);
CFMService.helloWorld();

Note: Due to ActionScript's automatic type conversion, do not return a boolean literal to Flash from ColdFusion. Return 1 to indicate true, and return 0 to indicate false.


Contents > Developing ColdFusion MX Applications > Using the Flash Remoting Service > Using the Flash Remoting service with ColdFusion pages > Returning results to Flash PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/usingsa6.htm