Nevermind, I found the answer:
http://stackoverflow.com/questions/1386346/parsing-xmllist

On Sun, Sep 6, 2009 at 2:22 PM, David<[email protected]> wrote:
> Hey yall,
> This seems like a pretty simple problem, which makes it all the more
> frustrating that I can't get it to work right:
> There is an XMLList of items, each item has three properties: prop1,
> prop2, and prop3.
> There are two TextAreas, t1 and t2.
> t1 displays the XMLList.toString
> t2 is blank
> There are two buttons: Show and Clear.
> When you click Show, the following should happen:
> For each item in the XMLList, if prop3 is false and prop1 is "BB",
> then add that item's prop2 to the text of t2.
> My code is below.
> It's only showing some of the results, not all expected. (It should
> show L3a and L3y. It only shows L3y.)
> What am I doing wrong?
> ===
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">
> <mx:Script>
> <![CDATA[
>        [Bindable]
>        private var xmlList:XMLList =
>                <>
>                <item prop1="AA" prop2="L0" prop3="true" >
>                        <item prop1="AA" prop2="L1a" prop3="true" >
>                        <item prop1="AA" prop2="L2a" prop3="true" >
>                                <item prop1="BB" prop2="L3a" prop3="false" />
>                                <item prop1="AA" prop2="L3b" prop3="false" />
>                        </item>
>                    </item>
>                    <item prop1="AA" prop2="L1b" prop3="true" >
>                                <item  prop1="AA" prop2="L2x" prop3="true" >
>                                        <item prop1="AA" prop2="L3x" 
> prop3="false" />
>                                </item>
>                                <item  prop1="AA" prop2="L2y" prop3="true" >
>                                        <item prop1="BB" prop2="L3y" 
> prop3="false" />
>                                </item>
>                        </item>
>                </item>
>                </>;
>        private function showBBs():void{
>                lookForBBs(xmlList.children());
>        }
>        private function lookForBBs(list:XMLList):void{
>                for each (var x:XML in list){
>                        if (x.it...@prop3 == "false"){
>                                if (x.it...@prop1 == "BB"){
>                                        t2.text += x.it...@prop2+"\n";
>                                }
>                        }
>                        else{
>                                lookForBBs(x.children());
>                        }
>                }
>        }
> ]]>
> </mx:Script>
>        <mx:HBox width="100%" height="100%">
>                <mx:TextArea id="t1" text="{xmlList.toString()}" width="100%" 
> height="100%"/>
>                <mx:Button label="Show" click="showBBs()"/>
>                <mx:Button label="Clear" click="{t2.text=''}"/>
>                <mx:TextArea id="t2" text="" width="100%" height="100%"/>
>        </mx:HBox>
> </mx:Application>
>
> ===
> Thanks!
> -David
>


-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------


Reply via email to