Take a look at the E4X documentation.  If you use the .. notation you
can return a selection of XML as an XMLList.  It is not an array, but
it behaves more like one.  It should be possible to use E4X to get an
array, the same as you would with XPath, I am just not sure of the
syntax right now.

Try this out:
in Main.xml

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; width="500">
        <mx:Script>
                <![CDATA[
                        public var myXML:XML = 
                        <div>
                                <tree>
                                        <branch>B1</branch>
                                </tree>
                                <tree>
                                        <branch>B2</branch>
                                </tree>
                        </div>;                 
                        [Bindable]      
                        public var myArr:XMLList = myXML..tree;
                ]]>
        </mx:Script>    
        <mx:TextArea text="{myArr}"  height="140"/>
        <mx:TextArea text="{myArr[1].branch}" />
</mx:Application>


--- In flexcoders@yahoogroups.com, "arnold_charming"
<[EMAIL PROTECTED]> wrote:
>
> Hi!
> 
> I want to transfer below XML to ArrayCollection. I'm going to use it
> with <mx:tree> container. I know I can also use XML but I would prefer
> arraycollection. Thank you for your help.
> 
> <node label="menu1"></node>
> <node label="menu2">
> <node label="submenu1"></node>
> <node label="submenu2"></node>
> </node>
> <node label="menu3"></node>
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to