Contact ZenDuo


Changing the right click menu in flash



flash-right-clickChanging the right click menu in flash files is relitivley simple. Using the code below and placing it on the root of your document you can add a new right click menu to your published files. This disables the existing zoom in, zoom out ect and enables you to attach functions to the buttons, whether it be launching a new web page or changing the colour of the movie clip document.

So heres what to do:

Paste the following code onto the root of your flash document, directly onto a blank frame, publish your movie, Job done!

And heres the code:

//define any functions to included on a menu item
function launchsite1(){
getURL("http://www.zenduo.co.uk", _blank);
}

function launchsite2(){
getURL("http://www.zenduo.co.uk/contact.php", _blank);
}

////Declare a new menu item
newmenu = new ContextMenu();//Hide the built in flash menu
newmenu.hideBuiltInItems();//define your new menu items
item1 = new ContextMenuItem("My Home Page", launchsite1);
item2 = new ContextMenuItem("Another Web Page", launchsite2);
newmenu.customItems.push(item1);
newmenu.customItems.push(item2);//Build New Menu
_root.menu = newmenu;

You can change add or remove any of the items above to suit your requirements.

This entry was posted on Monday, September 28th, 2009 at 7:35 pm and is filed under ActionScript & Flash. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply