Reputation: 593
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?
Upvotes: 2
Views: 4350
Reputation: 1103
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.
Upvotes: 1
Reputation: 2935
The only way to add buttons to a browser default context menu is developing an extension for the browser.
So you need your custom context menu which can be done using HTML elements (+JavaScript), or Flash. Of course Flash Player is installed on most browsers nowadays; but there's a very low possibility that your website viewer doesn't have Flash Player installed on his browser.
Therefore, I suggest you to create your context menu using HTML + CSS + JavaScript (jQuery will help a lot). For examples, you may want to take a look at MediaFire, Yahoo! Mail, etc.
Upvotes: 0