//增加树右键菜单
?public function addTreeMenu():void
{
?cm=new ContextMenu();
?var newPrj:ContextMenuItem=new ContextMenuItem("创建工程");
?var newFol:ContextMenuItem=new ContextMenuItem("创建目录");
?var upfiles:ContextMenuItem=new ContextMenuItem("上传文件");
?var deploy:ContextMenuItem=new ContextMenuItem("发布");
?newPrj.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,onNewProjectCommand);
?newFol.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,onNewFolderCommand);
?upfiles.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,onImportFilesCommand);
?deploy.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,onDeployProjectCommand);
?cm.hideBuiltInItems();
?cm.customItems.push(newPrj);
?cm.customItems.push(newFol);
?cm.customItems.push(upfiles);
?cm.customItems.push(deploy);
?treeProject.contextMenu=cm;
}
//右击选中节点
if (evt.mouseTarget is UITextField)
?{
??treeProject.selectedItem=TreeItemRenderer(UITextField(evt.mouseTarget).owner).data;
}
treeProject为<mx:Tree id="treeProject"