Mega Code Archive

 
Categories / Flex / Data Model
 

Loop through a Model

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">   <mx:Script>              private function displayStates(  ):void {             for(var i:uint = 0; i < statesModel.state.length; i++) {                 statesTextArea.text += statesModel.state[i] + "\n";             }         }      </mx:Script>   <mx:Model id="statesModel">     <states>       <state>A</state>       <state>B</state>       <state>C</state>     </states>   </mx:Model>   <mx:VBox>     <mx:Button click="displayStates(  )" />     <mx:TextArea id="statesTextArea" height="500" />   </mx:VBox> </mx:Application>