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.

Post to Twitter Tweet This Post

Related posts:

  1. Coldfusion / jrun on macbook pro (intel)
  2. Bender: The Flex to Transfer Bridge
  3. Flex 2 – Webcam motion tracking part 3
  4. Flex 5 day Course – Day 1
  5. Flex 5 day course
  • Trackbacks are closed
  • Comments (0)
  1. No comments yet.