Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Remoting / December 2005



Tip: Looking for answers? Try searching our database.

return type struct not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
database_monkey - 05 Aug 2004 19:11 GMT
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.
database_monkey - 06 Aug 2004 20:40 GMT
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)
OneFineNight - 12 Aug 2004 15:41 GMT
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
database_monkey - 12 Aug 2004 16:04 GMT
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?
OneFineNight - 17 Aug 2004 12:52 GMT
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
database_monkey - 23 Aug 2004 17:33 GMT
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.
Frog_Tantrum - 09 Dec 2005 09:48 GMT
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.
Frog_Tantrum - 09 Dec 2005 10:13 GMT
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)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.