Access XML elements by index : XML Element « XML « Flash / Flex / ActionScript






Access XML elements by index

 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var novel:XML = <BOOK>
            <AUTHOR>J, J</AUTHOR>
            <AUTHOR>S, S</AUTHOR>
          </BOOK>;
        
        trace(novel.AUTHOR[0]);
        trace(novel.AUTHOR[1]);

    }
  }
}

        








Related examples in the same category

1.Change the element's value
2.Assign XML element value
3.Accessing Text Nodes
4.Use the dot operator (.) on the XML instance and add the element
5.Create a new element by creating a property on the XML instance and assigning it a value