1 Reply Latest reply on Dec 10, 2009 4:12 PM by PeakDigital

    Add branch node to Tree at runtime?


      I need to be able to allow users to add both "branches" and "leaves" to a Tree. I am trying to do this without utilizing external inputs. In one of the Help articles it said 'leaf nodes can be added at runtime' but didn't say anything about branches, and the example used an external TextInput to type the name for the new leaf node.


      I built this function that runs without error, but does not alter the Tree's dataProvider:

      public function addNewBranchNode():void
                  var xmlNewNode:XML=new XML(<parentNode></parentNode>);
                  xmlNewNode.@Title="Click and type the title you want";
                  var intNewPos:int=_primaryListManager.treePrimaryListManager.dataProvider.length-2;


      I have my "add new" button as the final item in the dataProvider, so I want the new branch node to be inserted directly above it.


      Any suggestions?