tags:

views:

572

answers:

1

Hi everybody,

I have a XML based Tree Control. The XML Structure is recursive, so the children's can have the same Element as the parent. I now want to let the user add and remove the elements. Do do so I need to get the parent element of the selected Item. Following code I already collected together:

var selected:XML = treeControl.selectedItem;
parent.insertChildAfter(selected:XML, newElement);

I just don't know how to get to the selected parents node as there is no such method like treeControl.selectedItem.parent...

Thanks for any hint! Markus

+1  A: 

You can do this with the parent() method on the XML object.

var parent:XML = XML(treeControl.selectedItem).parent();
Christophe Herreman
Yep thats it! Thanks Christophe!
Markus