[AS3]添加右键菜单项(上下文菜单) 2007-07-31 09:19 /***************************************************/* [来源 : [http://hi.baidu.com/9uflash ] * [作者 : [烧开水的鱼 ] * [说明 : 将如下代码放入第一帧,请自行添加所需元件] /**************************************************/ var myContextMenu:ContextMenu = new ContextMenu();//声明菜单新项var item:ContextMenuItem = new ContextMenuItem("Hello World");//添加到菜单显示项目数组myContextMenu.customItems.push (item);this.contextMenu = myContextMenu; //点击按钮引发该事件item.addEventListener (ContextMenuEvent.MENU_ITEM_SELECT ,mouseRelease);function mouseRelease (event:ContextMenuEvent){var txtField:TextField=new TextField();txtField.text="Hello World";addChild (txtField);}