We have
<<
component.
First of all we bind context menu to it by: myXMLTree.contextMenu = m_menu; Second, the idea is to hande itemRollOver event on a tree, to know on which item the cursor is pointed right now. So "itemRollOver" event handler hold it's value in global variable "selectedTreeItem" every time we roll mouse over any item of the tree we update
public function updateCurrentSelectedItem(le:ListEvent):void {
selectedTreeItem = (le.itemRenderer.data as XML);
}
So when we handle rightClick on tree, we use selectedTreeItem global variable to know which item has been clicked when context menu has been called.