macromedia flash flash remoting:
Hello there,
I want to pass an array from cold fusion into Flash, but I can't get the
values with Action Script. The NetConneciton Debugger shows that the values I
want were indeed passed to Flash, but I can't get to them with ActionScript.
Here's the CFC script (where I first pass values from flash into coldFusion):
<cffunction name="getSpecificDuration" access="remote">
<!-- params from FLASH -->
<!-- create local array to loop array.length times -->
<cfset areas = ArrayNew(1)>
<cfset areas[1] = "#Flash['areaOne']#">
<cfset areas[2] = "#Flash['areaTwo']#">
<cfset areas[3] = "#Flash['areaThree']#">
<cfset areas[4] = "#Flash['areaFour']#">
<!-- create empty array to store values that will be passed back to Flash -->
<cfset durations = ArrayNew(1)>
<cfloop index="i" from="1" to="#ArrayLen(areas)#">
<cfquery name="appendOne" datasource="dbusertracking">
SELECT Sum(contDuration)
FROM tb_contarea
WHERE contName = '#areas#'
</cfquery>
<cfset ArrayAppend(durations, appendOne)>
</cfloop>
<cfreturn durations>
</cffunction>
--------------------------------------------------------------------------------
-----------------------
After calling this CF function, the NetConneciton Debugger displays:
DebugId: 0
EventType: "Result"
MovieUrl: "........my.swf"
Protocol: "http"
Source: "Client"
Time: 1123004416148
Date (object #1)
....."Tue Aug 2 13:40:16 GMT-0400 2005"
Result (object #2)
.....[0] (object #3)
..........length: (undefined)
..........mRecordsAvailable: 1
..........serverInfo: (undefined)
..........uniqueID: 1
..........items (object #4)
...............[0] (object #5)
....................Sum(contDuration): 109
....................__ID__: 0
..........mTitles (object #6)
...............[0]: "Sum(contDuration)"
..........views (object #7)
...............No properties
.....[1] (object #8)
..........length: (undefined)
..........mRecordsAvailable: 1
..........serverInfo: (undefined)
..........uniqueID: 1
..........items (object #9)
...............[0] (object #10)
....................Sum(contDuration): 48
....................__ID__: 0
..........mTitles (object #11)
...............[0]: "Sum(contDuration)"
..........views (object #12)
...............No properties
.....[2] (object #13)
..........length: (undefined)
..........mRecordsAvailable: 1
..........serverInfo: (undefined)
..........uniqueID: 1
..........items (object #14)
...............[0] (object #15)
....................Sum(contDuration): 41
....................__ID__: 0
..........mTitles (object #16)
...............[0]: "Sum(contDuration)"
..........views (object #17)
...............No properties
.....[3] (object #18)
..........length: (undefined)
..........mRecordsAvailable: 1
..........serverInfo: (undefined)
..........uniqueID: 1
..........items (object #19)
...............[0] (object #20)
....................Sum(contDuration): 117
....................__ID__: 0
..........mTitles (object #21)
...............[0]: "Sum(contDuration)"
..........views (object #22)
...............No properties
--------------------------------------------------------------------------------
------------------------------------
My AS function that retrieves this "array" is:
function getInfo(whichData) //---- get server response ----//
{
//receives data returned from the method
this.onResult = function(result) {
//trace("Data received from server : " + result);
for (var i=0; i < result.length; i++) {
thisDuration = result.item;
trace("duration "+ i + " = "+ result.); //*********
}
}
};
--------------------------------------------------------------------------------
--------------------
When I use:
trace("duration "+ i + " = "+ result.); The output window displays:
duration 0 = [object Object]
When I use:
trace("duration "+ i + " = "+ result.item); I get: duration 0 = undefined
What am I doing wrong??