Set resultFormat="e4x", and do not depend on the built in decoder.  Loop
over the XML list and build you own ArrayCollection.  

 

Or use ArrayUtil.toArray(), 

 

Or inspect the result and handle it conditionally.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of elevight
Sent: Tuesday, April 21, 2009 9:00 PM
To: [email protected]
Subject: [flexcoders] Perennial problem with Flex -- single element vs
multi-element

 






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:

<root>
<node ..../>
<node ..../>
<root>

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:

<root>
<node ..../>
</root>

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.

Thanks.



Reply via email to