Changing the swf right-click menu
I need to begin by saying that full customisation of the swf right-click menu is only available in Flash MX 2004 and higher. If you're stuck with an earlier version, the best you can do is disable the menu by using
FSCommand("showMenu", false);
=========================================================
OK. So if you ARE using MX 2004, you can basically change the swf context menu to suit your needs.
Lets start off by creating a new menu, and hiding the default Macromedia entries. This should be on the first frame of your Flash:
var myMenu=new ContextMenu();
myMenu.hideBuiltInItems();
Next, let's create a menu item that will open Newgrounds in a browser, and add the text 'Visit Newgrounds' to the menu
function itemHandler1(obj, item){getURL("http://newgrounds.com");}
item1=new ContextMenuItem("Visit Newgrounds", itemHandler1);
myMenu.customItems.push(item1);
This code could alternatively be written like this:
myMenu.customItems.push(new ContextMenuItem("Visit Newgrounds", itemHandler1));
function itemHandler1(obj, item){getURL("http://newgrounds.com");}
Finally, we replace the default menu with myMenu
_root.menu=myMenu;
That's it. You have a new context menu.
=========================================================
Here's an example that will show 'Stop' and 'Play' on the menu, greying one each one out when it's pressed.
var myMenu=new ContextMenu();
myMenu.hideBuiltInItems();
myMenu.customItems.push(new ContextMenuItem("Stop!", itemHandler0));
myMenu.customItems.push(new ContextMenuItem("Play!", itemHandler1));
myMenu.customItems[1].separatorBefore = true; //this will add a separator between the two items
function itemHandler0(obj, item){
_root.stop();
myMenu.customItems[0].enabled=false;
myMenu.customItems[1].enabled=true;
}
function itemHandler1(obj, item){
_root.play();
myMenu.customItems[0].enabled=true;
myMenu.customItems[1].enabled=false;
}
_root.menu=myMenu;
You can basically create as many itemHandler functions as you want, and push them into the menu array. In fact, it's entirely possible to adapt this code and run it on button/MC rollovers & rollouts, to allow different context menus for different symbols in your movie/game
More information
http://www.actionscript.org/fo...3?t=47891&page=2&pp=15
http://planetbob.net/ftd/contextmenu/contextmenu.htm
http://www.actionscript.org/tutorials/intermediate/context_menu/index.shtml