//设置监控右键菜单项 private function setUserMenuItem():void{ var contextMenu:ContextMenu = new ContextMenu(); contextMenu.hideBuiltInItems(); // 隐藏一些内建的鼠标右键菜单项 var cmiGoRoundMenuItem:ContextMenuItem = new ContextMenuItem("方法1",true); contextMenu.customItems.push(cmiGoRoundMenuItem); cmiGoRoundMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, f1); //var cmiCheckMenuItem:ContextMenuItem = new ContextMenuItem("核查调度",true); //contextMenu.customItems.push(cmiCheckMenuItem); //cmiCheckMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, checkAttemperFunction); var cmiTaskQueryMenuItem:ContextMenuItem = new ContextMenuItem("方法2",true); contextMenu.customItems.push(cmiTaskQueryMenuItem); cmiTaskQueryMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, f2); var cmiMessageSendMenuItem:ContextMenuItem = new ContextMenuItem("方法3",true); contextMenu.customItems.push(cmiMessageSendMenuItem); cmiMessageSendMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, f3); this.pPanel.contextMenu = contextMenu;//向对象中添加右键菜单 } private function f1(event:ContextMenuEvent):void{ event.target.caption = "方法1调完成";//改变标题 Alert.show("1"); } private function f2(event:ContextMenuEvent):void{ Alert.show("2"); } private function f3(event:ContextMenuEvent):void{ Alert.show("3"); }