Accessibility

TechNote (Archived)

Getting started with ColdFusion MX, Adobe Flash Remoting and Adobe Flash MX

Getting started with ColdFusion MX, Adobe Flash MX and Adobe Flash Remoting can be challenging if you are unfamiliar with any one of the products. The samples provided in this TechNote hope to make you successful with your first attempts with getting Adobe Flash MX 2004 or Adobe Flash MX 8 to communicate to ColdFusion.

This TechNote provides a small Adobe Flash source file with instructions to get Adobe Flash Remoting working with ColdFusion. Two samples are provided, one for Adobe Flash MX 8 and one for Adobe Flash MX 2004. Each SWF file uses Adobe Flash Remoting ActionScript classes to communicate to the same ColdFusion CFC.

Install all required software

Follow the checklist below to make sure you have all the required software.

  1. Install the latest version of ColdFusion MX available (MX 7.0.1 as of 11/28/05).
  2. Install the latest version of Adobe Flash MX available (MX 8 as of 11/28/05).
  3. Install the Adobe Flash Remoting Components.
  4. Adobe Flash MX 2004 users also need to install the Source Code for Macromedia Flash Remoting Components for Flash MX 2004 ActionScript 2.0. Adobe Flash MX 8 already includes the source.
Install the CFC

At this point you should be ready to run the helloworld test file. Download flashremoting.zip and place the included CFC within your ColdFusion directory structure. For this test, we recommend you place the test.cfc in a new directory off the ColdFusion root called flashremoting. For instance, for a J2EE install this would mean you place the CFC in C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\flashremoting. For standalone installs this is located at c:\cfusionmx\wwwroot\flashremoting.

At this point you can open and edit the test CFC. The CFC has three functions that can be called from the Adobe Flash client. No changes to the CFC are required to run this test. Once you have run the test, you might want to try making some changes to test your project requirements.

Test from the Adobe Flash client
  1. Start Adobe Flash MX and open helloworld.fla (Flash 8) or helloworldmx2004.fla (Flash MX 2004).
  2. Review the code and instructions within the helloworld file.

    You do not need to change any ActionScript to run this test.
  3. Press Control\Enter to run the SWF file.
  4. When the movie runs, edit the Server port if needed (it is set to 8300 initially).
  5. Edit the CFC location if you did not save it in a flashremoting directory off the ColdFusion MX root.
  6. You can now click on the buttons to make the Flash Remoting calls to the CFC. You should see your data in the Results Pane.
  7. Congratulations - you are Remoting.

At this point all the pieces are in place and you are ready to start building Adobe Flash clients and CFCs.

Troubleshooting
Undeploying JRun's Flash Remoting

JRun creates new server instances with a deployed Adobe Flash Remoting Enterprise Application (EAR) from a file located in \JRun4\lib\flashremoting.ear. This may interfere with any applications you create within JRun server where you have installed ColdFusion MX and you want to use Flash Remoting. To undeploy the flashgateway.ear, click the server name in the left frame of the JRun Management Console. Once in the JMC, click J2EE components, then click "X" next to the Flash Remoting EAR.

Adobe Flash Remoting relies on mapping in the web.xml file
 <servlet-mapping id="macromedia_mapping_1"><servlet-name>FlashGateway</servlet-name><url-pattern>/flashservices/gateway/*</url-pattern></servlet-mapping> 

ColdFusion comes installed with this mapping and normally you do not have to touch this mapping. However, if problems persist, it might be a good place to double check to make sure it's still in place.

ColdFusion MX 7 Gateway Connection URL

If you are using Adobe Flash Remoting to access ColdFusion code, you may run into an issue where ColdFusion constructs an invalid URL when appending a jsessionid. If this occurs, the web server that is accessing your code could throw errors. The solution is to simply add a question mark (?) to the end of the gateway URL. Change /flashservices/gateway to /flashservices/gateway?. This ensures that the URL is created correctly.

This issue is resolved with ColdFusion MX 7 cumulative hot fix 2 or higher, so the workaround mentioned above is not needed if the cumulative hot fix or ColdFusion MX 7.0.1 has been installed.

Additional Information


AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support

Document Details

ID:e514dd93

Products Affected:

coldfusion
flashremoting