all groups > macromedia flash flash remoting > november 2003 >
You're in the

macromedia flash flash remoting

group:

Recieving Structures back from CF using MX 2004 Pro



Recieving Structures back from CF using MX 2004 Pro chim
11/18/2003 6:41:21 PM
macromedia flash flash remoting: I am having a touch of trouble with using structures (objects) in coldfusion and then returning them to FlashMX 2004 Pro via remoting. (v7 player)

The coldfusion templates works fine for Flash v6. The Flash code below populates my resultTable with valid results. When i publish with v6 - the list is popluated with proper values. When I publish with v7 - the list gets populated by "undefined" values. It seems that v6 can reference the data in the structure properly - but v7 cannot.

Is there a different way to access values stored in (coldfusion structures) objects with v7 versus the old way (v6)? The structure (and all the inheriant data) is still passed to the flash player in v7 -- I just don't know what to do to reference the data.

Can anyone help?


Thanks in advance.

Ryan D.
chimera_machane@hotmail.com

/* In flash */
function getAllAddressed_Result(result){
for(i = 0; i < result.length; i++)
{
_level1.resultTable.addItem(result.ScreenNum);
}
}

/* CFC */
<cffunction name="getAllAddressed" access="remote" returntype="array">
<cfargument name="courseid" type="string" required="true">
<cfset tempArray = ArrayNew(1)>

<cfquery datasource="#DataSource#" name="ScreenNums">
SELECT DISTINCT ScreenNum FROM ScarabTalk
WHERE courseid = <cfqueryparam value="#courseid#"cfsqltype="cf_sql_varchar">
AND Complete = 1
AND Approved = 0
</cfquery>

<cfset count = 1>
<cfset tempStruct = StructNew()>
<cfset tempStruct.ScreenNum = "None">
<cfset tempArray[count] = tempStruct>

<cfloop query="ScreenNums">
<cfset tempStruct = StructNew()>
<cfset tempStruct.ScreenNum = #ScreenNums.ScreenNum#>
<cfset tempArray[count] = tempStruct>
<cfset count = count + 1>
</cfloop>
<cfreturn tempArray>
</cffunction>



Re: Recieving Structures back from CF using MX 2004 Pro marmot
4/28/2004 4:57:05 PM
Ryan,

have you found the workaround?
I have the same problem and have no ideas.

Re: Recieving Structures back from CF using MX 2004 Pro mlabriola
4/30/2004 2:50:23 PM
You can pass structures back through remoting without much problem. The key
is the case sensitivity. When passing data back from ColdFusion through Flash
Remoting, some of the cases seem to get a little mangled. In reality, it makes
a bit of sense if you realize that ColdFusion stores the structure names in all
caps.

So here is the deal, when a query comes back, the case will be in tact from
whatever you specified in ColdFusion. When a struct that you create comes
back, the keys will be in all caps. My suggestion is to open the NetConnection
Debugger and look at the data as it returns. The field capitialization in the
debugger is correct, and this is how it should be used within your code.

Hope that helps,
ML
Re: Recieving Structures back from CF using MX 2004 Pro marmot
4/30/2004 3:41:57 PM
AddThis Social Bookmark Button