PDA

View Full Version : adding nodes to Tree


Can I
05-06-2007, 01:16 PM
hi,

I'm having problem with adding nodes to Tree component

the function looks like this:

public function addNode() : void {
var parentBranch : XML = concreteView.tree.selectedItem != null
? concreteView.tree.selectedItem as XML
: ( concreteView.tree.dataProvider as XMLListCollection ).source[ 0 ];
if ( concreteView.newItemTxt.text != "" ) {
var newBranch : XML = <branch />;
newBranch.@name = concreteView.newItemTxt.text;
parentBranch.appendChild( newBranch );
concreteView.newItemTxt.text = "";
}
}


It works fine most of the time, but not always. To see what bug I'm talking about please visit http://mindmap.cani.pl/MindmapCreationPanelTest.html
- unfold all nodes
- select first branch
- and try adding a node
it get's added, but second branch disappears. If you fold and unfold first branch it looks fine again, but if you try to fold the root 113 node you'll get an error

what could be the problem and how to work around it?