Custom Right Click Menu
Description: Change flash's default right-click menu using actionscript.
Author: John Bezanis
Added: January 21st 2007
Version: Flash 8
Changing the right click menu is simple and takes only a few lines of code.

Place the following code in the Actions tab on the main stage:
- var linkURL="http://www.bezzmedia.com";
- var linkText="Link Text";
- //Defines a new right-click menu
- var myMenu = new ContextMenu();
- //goToThisURL is a function that gets run whenever the link is clicked
- function goToThisURL(){
- //_blank opens the link in a new window
- getURL(linkURL, "_blank");
- }
- //Create a new item for the new menu.
- var copyright = new ContextMenuItem(linkText, goToThisURL);
- //Add the item to the new menu
- myMenu.customItems.push(copyright);
- //Hide flash's built in items (zoom in, zoom out, etc)
- myMenu.hideBuiltInItems();
- //Apply the new menu
- _root.menu = myMenu;
- function someFunctionName(){
- //_self opens the link in the same window
- getURL(linkURL, "_self");
- }
- var menuItem = new ContextMenuItem("Some More Link Text", someFunctionName);
- //Add the item to the menu
- myMenu.customItems.push(menuItem);
Download Source File
Comments Currently Disabled


