Re: [flexcoders] Perennial problem with Flex -- single element vs multi-element

2009-04-21 Thread Josh McDonald
Or build an XSD. Without it, how on earth is Flex's built-in decoder going
to know that sometimes there's many  elements, but right now there's
not?

-Josj

2009/4/22 Tracy Spratt 

>
>
>  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:
>
> 
> 
> 
> 
>
> 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.
>
> 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/


RE: [flexcoders] Perennial problem with Flex -- single element vs multi-element

2009-04-21 Thread Tracy Spratt
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:






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.

Thanks.





[flexcoders] Perennial problem with Flex -- single element vs multi-element

2009-04-21 Thread elevight
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.

Thanks.