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.
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)
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
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?
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
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.
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.
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)
Don't see what you're looking for? Try a search.
|