0

我想在 adobe player 的 flash 上下文菜单中添加一个选项。我怎样才能做到这一点 ?

4

1 回答 1

2

您想要将项目添加到上下文菜单。查看ContextMenu类和相关示例

这是我写的关于这个主题的博客文章;它将上下文菜单添加到图像。这是来源:

<?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>
于 2012-09-13T12:28:36.703 回答