문제

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

도움이 되었습니까?

해결책

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

var parent:XML = XML(treeControl.selectedItem).parent();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top