flex 添加右键链接

private var myMenu:ContextMenu;
            private function setViewerVersion():void
            {
                var menuItem:ContextMenuItem = new ContextMenuItem("技术支持:中科天宇软件有限公司", true, true);
                menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function(event:ContextMenuEvent):void
                {
                    navigateToURL(new URLRequest("http://www.tiannyu.com/"));
                });
                myMenu = new ContextMenu();
                myMenu.customItems.push(menuItem);
                
                myMenu.hideBuiltInItems();
                this.contextMenu = myMenu;
                
                if (this.contextMenu)
                {
                    if (this.contextMenu["customItems"] is Array)
                    {
                        while((this.contextMenu["customItems"] as Array).length>0)
                        {
                            (this.contextMenu["customItems"] as Array).pop();
                        }
                        (this.contextMenu["customItems"] as Array).push(menuItem);
                    }
                    else if (this.contextMenu["addItem"])
                    {
                        this.contextMenu["addItem"](menuItem);
                    }
                }
            }

 

你可能感兴趣的:(flex 添加右键链接)