码迷,mamicode.com
首页 > 其他好文 > 详细

Flex 右键菜单控制

时间:2015-05-22 14:46:59      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

            //设置监控右键菜单项
            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");
            }

 

Flex 右键菜单控制

标签:

原文地址:http://www.cnblogs.com/aegisada/p/4522122.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!