建立右键菜单项:
var cm:ContextMenu=new ContextMenu();
cm.hideBuiltInItems();//隐藏系统菜单(不全隐藏)
cm.builtInItems指向右键菜单的系统项是个ContextMenuBuiltInItems对象
如: cm.builtInItems.print=true;使其打印可选
cm.customItems是个数字指定右键菜单项目
new ContextMenuItem("菜单1",false,true,true)建立一个右键菜单项目,必须指定到customItem中,第一个参数为是否上面出现间隔线,第二个为是否禁用,第三个为是否显示;
如: cm.customItems.push(new ContextMenuItem("hello",false,false,true))

 

常用事件:
cm.addEventListener(ContextMenuEvent.MENU_SELECT,function(){trace("ss")})//当右键菜单触发时

cm.customItems[i].addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,MenuItemSelectHandler);//当某个选择项触发时e.currentTarget.caption;得到相应的caption

posted on 2010-09-25 14:42  星光~  阅读(915)  评论(0编辑  收藏  举报