look index of a child node up using childIndex() : childIndex « XML « Flash / Flex / ActionScript






look index of a child node up using childIndex()

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var movieList:XML = <movieList>
                                <listName>My favorite movies</listName>
                                <movie id="123">
                                    <title>Titus</title>
                                    <year>1999</year>
                                    <director>J T</director>
                                </movie>
                                <movie id="456">
                                    <title>Rushmore</title>
                                    <year>1998</year>
                                    <director>W A</director>
                                </movie>
                                <movie id="789">
                                    <title>Hall</title>
                                    <year>1977</year>
                                    <director>Woody Allen</director>
                                </movie>
                           </movieList>;
        
        
        trace(movieList.movie[2].childIndex()); // Displays: 3

    }
  }
}

        








Related examples in the same category

1.Accessing Sibling Nodes
2.Get previous Sibling from a giving xml data
3.Get the next sibling from a giving xml data