Solving A Problem In Relating An ActionScript Class To A ColdFusion CFC

I just spent an hour trouble shooting an issue I was having with a Flex 2.0 application that uses an ActionScript 3.0 class that is an alias for (based on) a ColdFusion CFC. Using ActionScript class aliases for ColdFusion CFCs allows you to pass back and forth specific types of Objects between Flex and ColdFusion. It turns out the solution was pretty simple, but is not something ColdFusion developers normally pay attention to.

In testing the basic connectivity between my Flex program and a ColdFusion CFC method that was returning an Object of type Member, I kept getting an error. I had used the Flex Builder wizard to create my ActionScript 3.0 class. When you use the wizard (right click on the CFC in Flex Builder and select ColdFusion wizard - create AS class based on CFC), you have to type a path to the related ColdFusion class. I typed the correct path in. Flex Builder created the AS3 class below:

[RemoteClass(alias="brucephillips.geeknews.Member")]

   [Bindable]
   public class Member
   {
    //variable declarations...     }

When testing the connectivity between my Flex application and the backend CFC that returns a Member object I kept getting an error. The error indicated that the object being returned by the ColdFusion CFC was not the correct type since the error occurred when I tried to cast the result to type Member.

/*result returned is a Member object
cast the result returned to a Member class
and assign it to our Member object
which we previously declared/*

aMember = event.result as Member ;

This lead me to believe that the path to the related CFC that I was using in the ActionScript 3.0 class was not correct. So I triple checked it and verified that the path was definately correct.

Finally, after trying some other trouble shooting techniques, I noticed that one of the folders in my path statement had some capital letters. However, in the path statement in my ActionScript 3.0 class (see above), I used all lower case letters. Could it be that the path to the CFC is CASE SENSITIVE?

After changing the path statement in the ActionScript to the correct case to exactly match the case of the folder names, everything worked fine. I've looked for a note about this in the documentation but just cannot find it. So just in case anyone else runs into the same problem:

WHEN CREATING AN ACTIONSCRIPT 3.0 CLASS THAT IS BASED ON A COLDFUSION CFC, THE PATH STATEMENT TO THE COLDFUSION CFC IS CASE SENSITIVE!!

(Yeah, I'm a little frustrated having wasted so much time on this.)

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.1.004.