Setting up Flash Remoting with AS 3 & ColdFusion

Setting up flash remoting with actionscript 3.0 and ColdFusion
Create a fla, call it remoting(or something that makes sense to you).

In the actions, type the following code

var gateway:NetConnection = new NetConnection();
var responder:Responder=new Responder(onResult,onFault);

function onResult(responds:Object):void {
    trace("cfc result"+":"+" "+responds.toString());

function onFault(responds:Object):void {
    //loop over the fault structure
    for (var i:String in responds) {
        trace( i + ":" + responds[i] );


// name the default cf test server on this machine

// name of the cfc and the function in it that you want to hit in dot notation"com.cfcs.getTest.getTestConn", responder/*this is where any arguments to the remote call go*/);

The cfc lives on my localhost/com/cfcs/gettestConn.cfc

The cfc will look like this

<cfcomponent displayName="getTest">
  <!--- Establish a Flash Remoting Connection --->
  <cffunction name="getTestConn" access="remote" returnType="string" output="true">
    <cfreturn "....connection successful">

When you run your flash file you should see this in the output window

download project

Move com folder to your ColdFusion localhost host, if you are running the default set up you will need to change the port to 8500. Then run the fla file, you should be fine, with flash & ColdFusion working together!

Any question, problems? Let me know I will try to help.
I will posting another example on how to display the results from your cfc, and later how to pull database results into your flash movie as well.

One thought on “Setting up Flash Remoting with AS 3 & ColdFusion”

  1. Do you know how to do the AS2 equivalent of setCredentials in AS3 so that Flash app can remote to a CFC secured with CFLOGIN. I know, I know most people don’t use cflogin, etc. but this app does and I am trying to get a Flash app targeting Flash Player 10.1 to be able to remote to a cfc that lives under an Application.cfc that uses CFLOGIN and roles to secure the application.

    This used to be easy in AS2:

    I think the trick is to add a header somewhere, but I have no luck. Do you have any idea?


Leave a Reply