all groups > macromedia flash flash remoting > august 2004 >
You're in the

macromedia flash flash remoting

group:

return type struct not working


return type struct not working database_monkey
8/5/2004 6:11:07 PM
macromedia flash flash remoting:
I have a simple cfc that returns an object. However, when trying to display the
results in flash, the results are empty. If I change the return type to boolean
or query, the results are returned fine. Has anyone else had this problem? I
had no problems with struct return types in remoting 1.0.

I'm running Flash 2004 with remoting 2.0.
Re: return type struct not working database_monkey
8/6/2004 7:40:04 PM
I've resolved the problem. It turns out that structs and arrays returned from a
..cfc are not enumerable. In my test code, I was using a for-in-loop which does
not work on these objects.

Page. 79 of Essential ActionScript 2.0 (Moock)
Re: return type struct not working OneFineNight
8/12/2004 2:41:44 PM
I am having this problem below is my code for CFC and AS:

<cffunction name="getLoadAllData" access="remote" returntype="struct">
<cfscript>
returnObj = StructNew();
returnObj.XboxTypeName = this.GetXBoxTypeList();
returnObj.XboxCLLIList = this.GetXBoxCLLIList();
returnObj.ListOfXbox = this.GetXBoxList("");
returnObj.EmpSBCUID = this.GetSBCEmpSBCUID();
returnObj.EmpFullName = this.GetSBCEmpFullName();
returnObj.TechSBCUID = this.GetFRVBDPRTechSBCUID();
returnObj.TechFullName = this.GetFRVBDPRTechUserName();
returnObj.EMailInfo = this.GetEMailInfo();
returnObj.ListOfCLLI = this.GetListOfCLLI();
returnObj.ListOfTechToCLLI = this.GetListOfTechToCLLI();
return returnObj;
</cfscript>
</cffunction>

function getLoadAllData_Result(result)
{
XboxTypeName_rs = result.XboxTypeName;
XboxCLLIList_rs = result.XboxCLLIList;
ListOfXbox_rs = result.ListOfXbox;
EmpSBCUID_rs = result.EmpSBCUID;
EmpFullName_rs = result.EmpFullName;
TechSBCUID_rs = result.TechSBCUID;
TechFullName_rs = result.TechFullName;
EMailInfo_rs = result.EMailInfo;
ListOfCLLI_rs = result.ListOfCLLI;
ListOfTechToCLLI_rs = result.ListOfTechToCLLI;

trace(result.length)
}

I do not return anything back, can you help me with this issue

Thanks

Re: return type struct not working database_monkey
8/12/2004 3:04:35 PM
Part of the problem is that result is a struct (according to the coldfusion
component) not an array. Attempting to access result.lenght should result with
an undefined.

Try outputting one of the structure properties.

trace(result.XboxTypeName);

Another thing to check is to make sure the result handler is getting invoked.
Just throw a trace("results received"); in the function.

Is the posted AS code complete?
Re: return type struct not working OneFineNight
8/17/2004 11:52:45 AM
Thanks for your reply

yes the posted AS code is complete.

I am getting to the function after coming from the flash remoting, I tried the
trace, it came back undefined.

sorry, for the long delay on the reply.

thanks
Re: return type struct not working database_monkey
8/23/2004 4:33:37 PM
Wow, sorry about MY long delay. I was out of town.

Are you using remoting 1.0 or 2.0? Just to clarify, you're sure that the
result handler is getting invoked? If you could, please post all the code and
we'll see if we can figure out what's wrong.
Re: return type struct not working Frog_Tantrum
12/9/2005 12:00:00 AM
Hi,

I'm having the same problem with cfmx 7 and Remoting v2.0 talking to a flash 8
app. The function in the cfc:

<cffunction access="remote" name="checkLogin" output="false"
returntype="struct"

<cfset myStruct = structnew() />
<cfset myStruct["loggedIn"] = 1 />

<cfreturn myStruct />

</cffunction>

In my flash output I'm getting an empty array returned:

12/9 9:34:37 [INFO] : Invoking checkLogin on myApp/securityGateway
12/9 9:34:37 [INFO] : myApp/securityGateway.checkLogin() returned []

Other data types are OK (queries, arrays, strings, etc). I can confirm that
the correct results function is being called.

Thanks.

Re: return type struct not working Frog_Tantrum
12/9/2005 10:13:50 AM
As a follow up to this problem, it turns out that data *was* being returned,
but not reported in the 'output' window:

12/9 9:34:37 [INFO] : Invoking checkLogin on myApp/securityGateway
12/9 9:34:37 [INFO] : myApp/securityGateway.checkLogin() returned []

Looking at the NetConnect Debugger however revealed that data was being
returned. I could access the structure members by using:

result.result["loggedIn"] (case sensitive)


AddThis Social Bookmark Button