Coldfusion returntype behaviour in flex

Just a gotcha for anyone else who runs into it - I had an issue today in retrieving data from a remoteobject call in flex. My flex code looked like this:

MyRO.methodName(args);
tempObj : * = MyRO.methodName.lastResult;
for (var i in tempObj) {
result_text.text += i;
}

Now all I was trying to do at this stage was verify that the correct data was coming through, but for some reason it appeared that the struct I was expecting from coldfusion was being sent properly, but it was being converted into an AS object with no keys! For example, the cf generated struct had a key called EmailAddress and from the above code, neither tempObj.EmailAddress or tempObj.EMAILADDRESS were valid.

What fixed it was changing the returntype on my cfc. I had had returntype="struct" on it, but I changed it to "any" and everything worked fine. Not 100% sure what it's doing differently or exactly what type it *is* passing but it seems to work now.

TrackBacks
There are no trackbacks for this entry.

Trackback URL for this entry:
http://www.tobytremayne.com/trackback.cfm?D4E13E31-F597-864B-384E4E6363DC35E5

Comments