3 Replies Latest reply on Apr 7, 2009 7:41 AM by Handycam

    Why can't I access this in an XMLListCollection?

    Handycam Level 1

      I am updating an older application to better use what I have learned in the interim.  I am using the same approach to loading XML and populating a viewstack based on the number of items in the XML file as I have been doing lately successfully.  However, for reasons I do not understand, this time it is not letting me access a value.

       

      [Bindable]

            private var dataXML:XMLListCollection = new XMLListCollection();

       

      private function dataHandler(event:ResultEvent):void {

              var list:XMLList = new XMLList(event.result..step);

             dataXML = new XMLListCollection(list);

              createSteps();

      }

       

       

       

      private function createSteps():void{

              for each(var step:XML in dataXML){

              var stepNumber:uint = 1;

              var recipeStep:CyorStep = new CyorStep();

              mainViewStack.addChild(recipeStep);

              trace(dataXML.title);

              }

      }                  

       

      I get an error: 1119: Access of possibly undefined property title through a reference with static type mx.collections:XMLListCollection

       

      Why?

       

      The XML is like:

      <steps>

      <step>

      <title>Meat, Poultry or Fish</title>

      <ingredientList">

      <items>

      ...

      </items>

      </ingredientList>

      <bodyText>....</bodyText>

      </step>

      <step>

      <title>Meat, Poultry or Fish</title>

      <ingredientList">

      <items>

      ...

      </items>

      </ingredientList>

      <bodyText>....</bodyText>

      </step>

      etc...

      </steps>