flex简单添加右键功能

private var newBuildMenuItem: ContextMenuItem;


internal function createMenu(): void{
treeMenu();

}

private function treeMenu(): void{
createTreeMenuItem();
myTree.contextMenu = getTreeContxtMenu();
}

public function createTreeMenuItem(): void{
newBuildMenuItem = new ContextMenuItem("定位");
newBuildMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, showMouseEvent);
}

private function getTreeContxtMenu(): ContextMenu{
var contextMenu: ContextMenu = new ContextMenu();
contextMenu.hideBuiltInItems();
contextMenu.customItems.push(newBuildMenuItem);
return contextMenu;
}

你可能感兴趣的:(flex)