Accessibility

Flash Remoting TechNote

Flash Remoting checklist for ColdFusion MX users

Although a Macromedia Flash user interface or front end is built using client-side software, in order for the front end to use Macromedia Flash Remoting, an application server that supports the Flash Remoting service (gateway) needs to be running on the web server that hosts the application. In addition, Macromedia Flash Remoting Components need to be installed and enabled within Macromedia Flash MX.

This TechNote describes the software and components required to use Macromedia Flash MX and Flash Remoting with Macromedia ColdFusion MX. It also describes how to test and troubleshoot the software and components.

Note: Macromedia Flash Remoting checklist for Macromedia JRun 4.0 users details the software and components required when using Macromedia Flash MX and Flash Remoting with Macromedia JRun 4.

Flash Remoting development requirements

To use Flash Remoting between Macromedia Flash movies and Macromedia ColdFusion MX, you'll need to install and configure the following in your development and deployment environment.

  • Macromedia ColdFusion MX
    Flash Remoting works between a client and a server. ColdFusion MX and its associated Flash Remoting service (gateway) must be running on the web server.

    See the Macromedia LiveDocs for installation instructions.
  • Macromedia Flash MX
    Macromedia Flash MX is the authoring environment in which to build an application's front end. Install Flash Remoting Components and enable them for an application within Flash MX.

    See the Macromedia Flash Support Center Installation page.
  • Macromedia Flash Remoting Components
    Flash Remoting Components are a set of ActionScripts and a NetConnection Debugger utility that need to be installed in your Macromedia Flash MX authoring environment in order for your movies to interface with Flash Remoting on the application server.

    Install the Flash Remoting Components any time after Macromedia Flash MX is installed. Begin the Flash Remoting install by running FlashRemotingCmpntsInstaller.exe. The install is very quick and doesn't require any user input.

    Flash Remoting ActionScript includes:
    • NetServices.as: Enables the connection to the application server's Flash Remoting service (gateway).
    • NetDebug.as: Enables the NetConnection Debugger utility for an application.
    • DataGlue.as: Formats the exchanged data.
    • RecordSet.as: Returns a recordset.

Once installed, enable specific Flash Remoting Components for a movie by adding ActionScript at the movie's frame level. For example, to enable the Flash Remoting service, the NetConnection Debugger utility and data formatting for a movie, add #include "NetServices.as" #include "NetDebug.as" #include "DataGlue.as" ActionScript at the top of the movie's first frame:

#include "NetServices.as"
#include "NetDebug.as"
#include "DataGlue.as"
    if (inited != true) {
        inited = true;
        NetServices.setDefaultGatewayUrl
("http://localhost:8200/flashservices/gateway");
        gatewayConnection =
 NetServices.createGatewayConnection();
        MyService = gatewayConnection.getService
("package.JavaBean",this);
    }

Note: You'll need to install the Macromedia Flash Player 6 in a browser in order to run an application that uses Flash Remoting.

Testing installations

Test installations to ensure that the ColdFusion MX application server is running, and that Flash Remoting Components are properly installed within Flash MX.

  • Macromedia ColdFusion MX (server) must be running.
    The easiest way to test this is to make a request to the Flash Remoting service:

    http://localhost:8500/flashservices/gateway

    Where 8500 in the path above is the default ColdFusion port.

    If a blank page is returned, then ColdFusion and the Flash Remoting service are running and working properly. If an error is returned, use the following questions to troubleshoot the install:
    • Is the server running?
    • Is the flashgateway.ear file located in the cf_root\runtime\servers\default folder?
    • Do the ColdFusion example applications work?
      Enter http://localhost:8500/cfdocs/exampleapps/flash2/index.cfm in a browser to run an example application.
    • Is there a Flash Remoting entry in the server log?
      When running Microsoft Windows, the following entry in the default-out.log file indicates that the server deployed the Flash Remoting ear file:
      05/22 14:03:38 info
      Deploying web application "Flash Remoting" from: file:
      /D:/dev/CFusionMX/runtime/servers/default/flashgateway.ear

      The default-out.log file resides in the cf_root\runtime\logs folder.
  • Macromedia Flash MX must be used to develop the Macromedia Flash applications that work with Flash Remoting. To test if Flash MX is successfully installed, choose:

    Start > Programs > Macromedia >Macromedia Flash MX

    Note: If you are only deploying existing applications (SWF files), you don't need to install the Flash MX authoring software.
  • Flash Remoting Components must be installed within Flash MX. To test the install:
    • Locate the {Flash MX install}\Configuration\Include folder on your computer.

      If the Include folder exists, then Macromedia Flash Remoting Components are installed.


    • or

    • Launch Flash MX. Select Window in the Menu bar (or press ALT+W) to open the Window menu.

      If the NetConnection Debugger is listed in the Window menu, then the Flash Remoting Components have been successfully installed.

Troubleshooting Flash Remoting after install

Troubleshoot Flash MX applications to ensure that Flash Remoting Components work correctly within a specific movie before deploying it.

NetConnection Debugger utility

Play a movie using the NetConnection Debugger utility in order to troubleshoot Flash Remoting problems during development. The utility displays error messages that you can use in order to solve problems before deployment.

There are two methods you can use to invoke the NetConnection Debugger.

Method 1: View NetConnection Debugger information after running movies

  1. Select Window > NetConnection Debugger (or press ALT+W).
  2. Run the movie by selecting File > Publish Preview > Flash.
  3. After the movie runs, select Window > MyMovie.fla to bring the NetConnection Debugger into focus.

Note: When you use this method, close MyMovie.swf after each debug session so that the movie will update the information displayed in the NetConnection Debugger.

Method 2: View NetConnection Debugger information while running movies

  1. With your movie open in Macromedia Flash MX, select Window > NetConnection Debugger.
  2. Run the movie by pressing CTRL + ENTER.
  3. The NetConnection Debugger shows the progress of the Flash Remoting calls while the movie is running.

NetConnection Debugger problems

If the NetConnection Debugger does not display when you open it:

  • Make sure that the ActionScript class NetDebug.as is included in the movie's first frame:
    #include "NetDebug.as"
  • If you used method one to invoke the NetConnection Debugger, close the SWF file after each debug session. Run the movie using Publish Preview again to start a new debug session and update NetConnection Debugger information.

Troubleshooting connections to the Flash Remoting service

When a movie can't connect to the Flash Remoting service, ensure that NetServices.as class and the connection to the gateway are referenced in the first frame:

  1. Select Window > Actions (or press F9).
  2. Select Actions for Frame 1 of Layer Name Layer 1 from the pop-up menu.
    Where Layer 1 is the name of your layer.
  3. Make sure that the code connecting your movie to Flash Remoting is in this frame or defined before using it.
  4. Make sure to include the NetServices.as class file in the first frame. The ActionScript in the first frame should look similar to this:
    #include "NetServices.as"
    #include "NetDebug.as"
    #include "DataGlue.as"
    if (inited != true) {
        inited = true;
        NetServices.setDefaultGatewayUrl
    ("http://localhost:8200/flashservices/gateway");
        gatewayConnection = 
    NetServices.createGatewayConnection();
        MyService = gatewayConnection.getService
    ("package.JavaBean",this);
        }
    Note: If you choose not to put NetServices.as and the connection information in the first frame, ensure that they are defined before you use Flash Remoting in your movie.

NetConnection Debugger Flash Remoting error messages

Error "NetConnection.Call.Failed"
Problem A connection cannot be established to the gateway. The server is not running or the URL to the gateway is not correct.
Solution Ensure that the server is running and you are pointing to the correct port (instance) in your gateway URL.

 

Error "Service threw an exception during method invocation: No service named demo.DealerGateway is known to Flash Remoting."
Problem The movie could not create the Service Object because it doesn't exist. Either the Service Object is misspelled, the path is incorrect, the object name is incorrect, or the application is trying to connect to an unsupported service.
Solution Ensure that the service and/or object name and paths are correct.

Additional information

See the Flash Remoting Release Notes to learn more about features and functionality.

See Debugging Flash Remoting within Macromedia Flash MX applications (TechNote 16474) for more information about the NetConnection Debugger utility.

Last updated: January 29, 2003
Created: May 27, 2002
ID: 16361
Product: Flash Remoting
Versions: All
OS: All
Browser: All
Server: All
Database: All
Former ID: N/A
 

Provide Feedback

less more

1

2

3

4

5

(300 characters or less - you will not receive a reply.)