2016-10-13 00:16:48 点击量:7 标签: 收藏本文
下面这个例子给Flex的右键添加一个自定义的菜单,并且在点击菜单内容时,执行事件
- var copyrightMenuItem:ContextMenuItem = new ContextMenuItem("菜单内容", true, true);
- copyrightMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,function(e:ContextMenuEvent){
- Alert.show((e.currentTarget as ContextMenuItem).caption);
- });
- var contextMenuCustomItems:Array = FlexGlobals.topLevelApplication.contextMenu.customItems;
- contextMenuCustomItems.push(copyrightMenuItem);
我使用的是Flex4,如果是Flex3,需要把var contextMenuCustomItems:Array = FlexGlobals.topLevelApplication.contextMenu.customItems;
替换为var contextMenuCustomItems:Array = application.contextMenu.customItems;
我们是一家提供综合软件外包与弱电工程服务的技术公司。
业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。
公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室