ContextMenuItem(caption:String, separatorBefore:Boolean = false, enabled:Boolean = true, visible:Boolean = true)
caption:指定上下文菜单中显示的菜单项标题(文本)
separatorBefore:指示指定的菜单项上方是否显示分隔条
enabled:指示指定的菜单项处于启用状态还是禁用状态
visible:指示在显示 Flash Player 上下文菜单时指定菜单项是否可见
- var myContextMenu:ContextMenu = new ContextMenu();
- var item:ContextMenuItem = new ContextMenuItem("Lemtree");
- var item1:ContextMenuItem = new ContextMenuItem("我已经Unabled",true,false,true);
- myContextMenu.customItems.push(item,item1);
- myContextMenu.hideBuiltInItems();
- this.contextMenu = myContextMenu;
- item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT ,mouseClick);
- function mouseClick(event:ContextMenuEvent) {
- var txtField:TextField=new TextField();
- txtField.width=400;
- txtField.text="你点击了右键子菜单:Lemtree";
- addChild(txtField);
- var url:String="http://www.cnblogs.com/lemtree/";
- var urlrequest:URLRequest=new URLRequest(url);
- navigateToURL(urlrequest,"_blank");
- }