Search code examples
javascriptflashcontextmenu

How to add item to Adobe Flash context menu?


Is there any way I can add an item to the context menu using JavaScript and HTML? I will use Flash if necessary.

This question has been answered here, but the solution was to create your own context menu. I just want to add an item to it, like seen in this Flash game. Is this only possible with Flash?


Solution

  • If I correctly understood you need to add items to flashplayer context menu, and it is possible with actionscript:

    var cMenu:ContextMenu = new ContextMenu();
    var item1:ContextMenuItem = new ContextMenuItem("some text");
    cMenu.hideBuiltInItems();
    cMenu.customItems.push(item1);
    contextMenu=cMenu;
    
    item1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, func1);
    
    function func1(e:ContextMenuEvent):void{
        //do some thing when item1 clicked
    }
    

    find more in this tutorial.