Now that ColdFusion developers are getting into Flash Remoting the questions are coming, the latest:
"How can I use the data structures that I'm used to in CF within a Flash Remoting application on the Flash side?"
I've put together a CFC/Flash combo to demonstrate this, including making the most of looping over the structures.
Ok, so we could come up with a variety of complex data types in development.
Let's think about some of the possibilities:
- Array
- Structure (associative array to others)
- Query
- Complex structure (e.g. array embedded in key)
- Complex array (e.g. query or structure embedded in index)
I've created a CFC that creates each of these and a Flash movie that, via Flash Remoting, calls all these data types, then processes and outputs the values recieved.
You can download the CFC, FLA and other files here (17805 bytes).
An interesting observation about structures and how the keys are named.
In ColdFusion we can choose to name a structure key using either array syntax or dot notation, if you choose to use array syntax the original case of the key will be preserved when transmitted to Flash via Flash Remoting.
Dot notation returns the keys as all capital letters, something most developers would be familiar with.

Structure keys created with array syntax.

NetConnection Debugger output for above structure.

Structure keys created with dot notation.

NetConnection Debugger output for above structure.
A small reminder to ColdFusion developers, when it comes to arrays we're in a special category. The first index of an array is usually 1, but for the rest of the world it's 0, the Flash Remoting process does the conversion of index numbering automatically for us.
If you look at the two examples immediately above you'll note that in the CFML the structure is being embedded into the second index of an array, yet in the debug it's sitting in the first index.
Andrew
Posted by at 07:18 AM | Permalink
Trackback: http://blog.daemon.com.au/cgi-bin/dmblog/mt-tb.cgi/40


Fantastic!
Posted by: Scott Barnes on September 19, 2002 06:41 PM
hi,
i downloaded this example program which is implementing this flash remoting mx components with cold fusion mx. I'm very new to this technology.
my problem : when i used this as per the instructions given, data is not getting populated. any suggestions please?
can any one explain these below statements please:
gatewayConnection = NetServices.createGatewayConnection
("http://127.0.0.1:8500/flashservices/gateway");
var server = gatewayConnection.getService("dm_FR.dataStructures", this);
my coldfusion server is configured to IIS and OS is win2k
thanx in advance.
Posted by: Sreenivasulu on October 31, 2002 01:05 AM
If you are really running CFMX under IIS then you are likely pointing to the wrong URL. The port 8500 is the CFMX built-in web server.
Try this instead:
NetServices.createGatewayConnection("http://127.0.0.1/flashservices/gateway");
Posted by: Geoff Bowers on October 31, 2002 09:11 PM
More likely IIS was not correctly setup. It needs to be configured manually for Flash Remoting to work correctly. Macromedia have recognised that and have a technote here:
IIS Gateway Connection
Posted by: Andrew Muller on October 31, 2002 11:24 PM