We had given for granted that it was not possible to use Flash Remoting with ColdFusion Flash Forms because of the ActionScript language restrictions that they have. All workarounds used external .swf loaded into the form, so we never used them and we never investigated any further. Otherwise, we would’ve found that there is a simple way to get remoting in ColdFusion Flash Forms sooner. In any case, here it is, better late than never. Note that this does not use external swf and therefore it is not a hack.
We had given for granted that it was not possible to use Flash Remoting with ColdFusion Flash Forms because of the ActionScript language restrictions that they have. All workarounds used external .swf loaded into the form, so we never used them and we never investigated any further. Otherwise, we would’ve found that there is a simple way to get remoting in ColdFusion Flash Forms sooner. In any case, here it is, better late than never. Note that this does not use external swf and therefore it is not a hack.
As an introduction, we made a simple example in which we call a cfc that returns a formatted string according to the parameter passed.
This is what the cfc does, as you can see it’s a very simple function.
A live example
Download the source
A couple of notes on Remoting:
The component that you call has to be web accessible for the Remoting gateway to find it, just like when you create a web service, and the method has to have access="remote".
The path to the component is the directory structure as viewed from the root of your website, separated by dots, followed by the component name. For example, if your component is located at http://www.example.com/somedir/components/myComponent.cfc, then the path would be somedir.components.myComponent
That being said, I never have my components in the root of my website, but in a mapping called com, where I have directories with the names of my domains. I then call my components com.blueinstant.somepackage.myComponent
This, however, won’t work with remoting, so what I do is create a façade component that exposes only the methods that flash needs, and can even format the data specifically for flash, separating this from my other components that know nothing about the views. In addition, from that component I can enforce security or call an already instantiated object that I keep in a shared scope.
Lastly, the documentation warns that Application.cfc should not implement the “onRequest” method if we have “any CFC files that are intended to be accessed as web services, using Flash Remoting, or using an event gateway”