Accessing Sibling Nodes : childIndex « XML « Flash / Flex / ActionScript






Accessing Sibling Nodes

 

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

        var novel:XML = <BOOK ISBN="0000000000">
            <TITLE>ActionScript</TITLE>                    <!--Previous sibling-->
            <AUTHOR>J, J</AUTHOR>
            <PUBLISHER>Books Ltd</PUBLISHER>  <!--Next sibling-->
          </BOOK>;
        
        var author:XML = novel.AUTHOR[0];
        // Previous sibling
        trace(author.parent().*[author.childIndex(  )-1]);  
        // Next sibling
        trace(author.parent().*[author.childIndex(  )+1]);  
    }
  }
}

        








Related examples in the same category

1.look index of a child node up using childIndex()
2.Get previous Sibling from a giving xml data
3.Get the next sibling from a giving xml data