Groups | Blog | Home
all groups > coldfusion flash integration > august 2005 >

coldfusion flash integration : Passing Multi Dimension Array to CFC from Flash


DaveHCYJ
8/1/2005 12:00:00 AM
Passing a single dimension array works just fine, but is there a way to pass a
multi dimension array?

Your thoughts/help would be greatly appreciated.


Here is what I am trying just to test things out:

<!--- my cfc that dumps the variable to a file just so that I can see if it is
recieved --->
<cffunction name="test" access="remote" returntype="string">
<cfargument name="test" type="struct" required="yes">

<cfsavecontent variable="dump">
<cfoutput><cfdump var="#test#"></cfoutput>
</cfsavecontent>

<cffile action="write" file="c:\inetpub\test.htm" output="#dump#">

<cfreturn "true">
</cffunction>


My Action Script that triggers a WebServiceConnector when I click a button:
on(click)
{
_parent.testconnector.params = new Object();
_parent.testconnector.params.test = new Array();
_parent.testconnector.params.test[0] = new Array();
_parent.testconnector.params.test[0][0] = "test";
_parent.testconnector.params.test[0][1] = "test2";
_parent.testconnector.trigger();
}

that does not work, however if I change the code to the following it works
fine (as a single dimmension array):
_parent.testconnector.params.test = new Array();
_parent.testconnector.params.test[0] = "test";
_parent.testconnector.trigger();

DaveHCYJ
8/1/2005 7:45:59 PM
I have resorted to making a work around. Since Flash and Coldfusion can work
with named indexes as well as numbered (in the form of structures in cold
fusion), I have simply done this:

I was originaly needing array elements such as:

myArray[0][0][0] = "text";
myArray[0][0][1] = "text2";
etc.

Instead I use:
myArray["0.0.0"] = "text";
myArray["0.0.1"] = "text2";

and then in cold fusion I have a function that converts that one dimension
array into a proper 3 dimensional array
AddThis Social Bookmark Button