title: Looping through an arraylist sourced from an XML file
body: <p>I am reading in an XML file that is shown in the attached image. I'm reading it in using URLRequest, which works properly. The next thing I'd like to do is to populate an arraylist with all of the "project" nodes. I'm converting the XML to an array, but the source is showing the project as being in the [0] node and the arraylist's length is 1. </p>
  
  <p><img src="https://i.stack.imgur.com/kiYeI.png" alt="enter image description here"> <img src="https://i.stack.imgur.com/yIuBp.png" alt="enter image description here"></p>
  
  <p>What's the proper way to do this so I can loop through all the projects in the arraylist?</p>
  
  <pre><code>private var xmlParameters:XML
  private var xmlStoryMap:XMLList;
  
  protected function application1_creationCompleteHandler(event:FlexEvent):void
  {
      var params:Object;
      var xmlLoader:URLLoader = new URLLoader();
  
      xmlLoader.addEventListener(Event.COMPLETE, xmlloader_onComplete_Handler);
      xmlLoader.addEventListener(IOErrorEvent.IO_ERROR,IOError_handler);
  
      xmlLoader.load(new URLRequest("myXML.xml"));    
  }
  
  protected function xmlloader_onComplete_Handler(event:Event):void
  {
      var loader:URLLoader = URLLoader(event.target)
  
      xmlParameters = new XML(loader.data);
      xmlStoryMap = xmlParameters.projects;
  
      initializeMap();
  }
  
  protected function initializeMap():void
  {
      var testlist:ArrayList = new ArrayList();
      testlist.source = convertXMLtoArray(xmlStoryMap.project);
  
  }
  
  private function convertXMLtoArray(file:String):Array
  {
      var xml:XMLDocument = new XMLDocument(file);
      var decoder:SimpleXMLDecoder = new SimpleXMLDecoder;
      var data:Object = decoder.decodeXML(xml);
      var array:Array = ArrayUtil.toArray(data);
  
      return array;
  }
  </code></pre>