2013-03-05 105 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