AS3 - Get an XMLList using a variable

594 views Asked by At

I have the following XMLList and am trying to return the XMLList with the node having the label Mail Box or Outbox, depending on string variable called folder. folder can either be equal to "Mail Box" or "Outbox".

    `<fx:XMLList id="treeData">
        <node label="Mail Box">
            <node label="Inbox">
                <node label="Marketing"/>
                <node label="Product Management"/>
                <node label="Personal"/>
            </node>
            <node label="Outbox">
                <node label="Professional"/>
                <node label="Personal"/>
            </node>
        </node>    
    </fx:XMLList>`

How can I return the XMLList? For instance, can I do something like var xmlList : XMLList = treeData.node.@label==folder;?

1

There are 1 answers

0
Cay On BEST ANSWER

You almost got it:

treeData.node.(@label==folder)