1 Reply Latest reply on Aug 20, 2007 7:39 PM by ntsiii

    How to get the tree index of a child node

    KentVIckery
      Hi, I am loading a tree object from an XML source file (via an XMLListCollection)

      I can find the children on the currently selected node, like:

      var children:XMLList = XMLList(myTree.selectedItem).children();

      for(var i:Number=0; i < children.length(); i++) {
      trace("Child Found: " + children .@caption);
      }

      But how can I determine the tree index for each of the children? I would like to be able to grab and save the tree index for each child, so that I can later just to do "myTree.selectedIndex = (saved child index) (based on some form action the user performs). I can't find any method of determining what the tree index for a child is, other than walking down the tree from the parent node and counting the number of nodes till I hit each child. Is there a simple method?