This content has been marked as final. Show 4 replies
I finally had a chance to circle back to this and I downloaded your xml editor. While i didn't actually run it i did have a chance to peruse the code and sure enough your delete method was exactly what I was looking for.
For anyone who happens upon this thread here's the solution:
private function deleteSelectedNode():void
// get the selectedNode into XML
var selectedNode:XML = XML(tree.selectedItem);
// get a listCollection of the selectedNodes siblings, the list collection
// is what provides us with the removeItemAt method.
var siblingList:XMLListCollection = new XMLListCollection(selectedNode.parent().children());
// figure out where the selectedNode is in relation to its siblings
var selectedNodeIndext:int = siblingList.getItemIndex(selectedNode);
// The "magic" line.
For discussion... it's curious that the XML object doesn't provide any sort of removeItemAt methods, and it doesn't seem like there's a good way to do it with e4x without using the "delete" keyword which, at least in my experience, is prone to complications.
"curious that the XML object doesn't provide any sort of removeItemAt "
No kidding. When I fussed about this I was told it is because the e4x specification does not call for it.
""delete" keyword which, at least in my experience, is prone to complications"
Double no kidding. It drives me nuts sometimes. But there it is. Remember the "Serenity Prayer".