Flex issue with single-element vs multi-element
Posted on 2009-04-21
For those of you who have been using Flex since 1.5, do you remember how Flex always had a problem returning single-element arrays as a non-array object, and how we had to apply mx.utils.ArrayUtils to force it to become a one-element array?
It seems like Flex 3.0 still has the same problem. If the XML I am getting from the server looks like this:
that is, a root tag with more than one child node, event.result.root.node will be of type ArrayCollection. But if the XML is like this:
where there is only one child tag, event.result.root.node becomes of type mx.utils.ObjectProxy. This is causing my application to bomb because I'm automatically storing the results in an ArrayCollection.
Has anyone had this problem before? Any suggestions on how to handle this would be greatly appreciated.