`
it_liuyong
  • 浏览: 98187 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

flex在树上添加右键菜单和右击选中当前项

 
阅读更多
//增加树右键菜单

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"
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics