2013-03-05 107 views
0

我想添加一个ContextMenu项目菜单在Flash中。这是代码。但它不会调用showVideoInfo函数。我错过了什么?Flash自定义右键快捷菜单

var myMenu:ContextMenu = new ContextMenu(); 
myMenu.hideBuiltInItems(); 
var customItem:ContextMenuItem = new ContextMenuItem("Show info"); 
myMenu.customItems.push(customItem); 
customItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, showInfo); 
this.contextMenu = myMenu; 

public function showInfo(){ 
    ExternalInterface.call("showAlert","Showing Information"); 
} 

回答

0

如果我的事件监听器添加到我的作品的自定义项目。请看下面的代码:

编辑:我相信你粘贴的原代码添加事件侦听器ContextMenu而不是ContextMenuItem

​​3210