Or build an XSD. Without it, how on earth is Flex's built-in decoder going
to know that sometimes there's many <node/> elements, but right now there's
not?

-Josj

2009/4/22 Tracy Spratt <tr...@nts3rd.com>

>
>
>  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:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
> Behalf Of *elevight
> *Sent:* Tuesday, April 21, 2009 9:00 PM
> *To:* flexcoders@yahoogroups.com
> *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.
>   
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Josh 'G-Funk' McDonald
  -  j...@joshmcdonald.info
  -  http://twitter.com/sophistifunk
  -  http://flex.joshmcdonald.info/

Reply via email to