Mega Code Archive

 
Categories / Flex / Data Model
 

Looping over nodes as keys

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"     backgroundColor="white" creationComplete="tryme()">     <mx:XML id="usersXML">         <root>             <users>                 <user id="1">                     <firstname>A</firstname>                     <lastname>A</lastname>                 </user>                 <user id="2">                     <firstname>J</firstname>                     <lastname>J</lastname>                 </user>             </users>         </root>     </mx:XML>     <mx:Script>                  [Bindable]         public var infoString:String = "";         public function tryme():void         {             for each(var node:XML in usersXML.users.user)             {               infoString = infoString + node.firstname;                infoString = infoString + node.lastname;             }         }            </mx:Script>     <mx:TextArea text="{infoString}" width="250" height="100" /> </mx:Application>