Our Flash tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Flash Tutorials Change The Right Click Menu
Your Ad Here

Change The Right Click Menu


Requirements

  • Flash MX2004 or higher.

Preview

1. Start by creating a new flash document or opening one you wish to add this functionality to.

2. Select frame 1 and press F9 to open the Actions Panel.

3. Now add the following code.

function menuChoiceOne() //Called when Choice One is clicked
{
        getURL("http://www.tutorialscene.com"); //Takes you to tutorialscene.com
}
function menuChoiceTwo() //Called when Choice Two is clicked
{
        //Does nothing
}
cmNew = new ContextMenu(); //Creates a new right click menu
cmNew.hideBuiltInItems(); //Hides the built in items
cmNew.customItems.push(new ContextMenuItem("Choice One", menuChoiceOne)); //Adds a new item on the right click menu named Choice One that calls menuChoiceOne() when pressed.
cmNew.customItems.push(new ContextMenuItem("Choice Two", menuChoiceTwo)); //Adds a new item on the right click menu named Choice Two that calls menuChoiceTwo() when pressed.
this.menu = cmNew; //Sets the right click menu in the flash movie to the one you just created

4. To have the right click menu not have any custom items on it delete the lines:

cmNew.customItems.push(new ContextMenuItem("Choice One", menuChoiceOne));
cmNew.customItems.push(new ContextMenuItem("Choice Two", menuChoiceTwo));

5. To change the text that is shown by the choices change "Choice One" to "Your Text Goes Here" or "Choice Two" to "Your Text Goes Here"

6. To change what happens when the choices are clicked, change what the functions that are called do.

7. To add more choices to the right click menu, first define a new function named "menuChoiceThree" then add another line like

cmNew.customItems.push(new ContextMenuItem("Choice Three", menuChoiceThree));

8. You should be able to test your movie now and use your right click menu.




Author's URL: Tutorial Scene
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Internet & computing Flash is a vector-based moving graphics format created by Macromedia for the publication of animations on the World Wide Web. More Flash & Swish: Most Popular Materials | Fresh Materials | More Flash Tutorials at FlashPerfection.com

Add comments to "Change The Right Click Menu"

Only registered users can write comment

Reader's comments
comments pHeR-d April 20, 2007 says:
Change The Right Click Menu
I like this tutorial. Thanks all.
Here is a tip: If you want just remove the Zoom In, out etc. u can use following code:

Code:
cmNew = new ContextMenu(); //Creates a new right click menu
cmNew.hideBuiltInItems(); //Hides the built in items
this.menu = cmNew; //Sets the right click menu in the flash movie to the one you just created