右键单击时为Flash播放器添加选项

时间:2012-09-13 12:06:22

标签: flex adobe flash

我想为adobe播放器的flash上​​下文菜单添加一个选项。我怎么能这样做?

1 个答案:

答案 0 :(得分:2)

您想要将项目添加到上下文菜单中。查看ContextMenu课程和related examples

这是a blog post我在这个主题上写的;它为图像添加了上下文菜单。这是来源:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()" width="100%" height="100%" viewSourceURL="srcview/index.html">
    <mx:Image width="100%" height="100%" source="assets/spacer.jpg" alpha="0" maintainAspectRatio="false" id="ImageTest" />

    <mx:Script>
        <![CDATA[

            public function onCreationComplete():void{
                var menuItem:ContextMenuItem = new ContextMenuItem("Version 1");
//                menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,doStuff);

                var customContextMenu:ContextMenu = new ContextMenu();

                //hide the Flash menu
//                customContextMenu.hideBuiltInItems();
                customContextMenu.customItems.push(menuItem);

                ImageTest.contextMenu = customContextMenu;
            }

            private function doStuff(e:Event):void{
                trace('stuff');
            }

        ]]>
    </mx:Script>
</mx:Application>