Toxiclab.org

Right Click Menu

16.6.2006, 12:18
Submited in: Flash | Total Views: 48593

This Tutorial will teach you how to create a simple right click menu in flash using the Action Script.

Step 1

Open a new flash document and create some button shape. After that take the Text Tool (T) and type Right click.





Step 2


Click on the first frame of layer 1, open the Action Script Panel (F9) and paste this script:
function menuChoiceOne()
{
 getURL("http://www.toxiclab.org");
}
function menuChoiceTwo()
{
 getURL("http://www.profileking.org");
}
function menuChoiceThree()
{
        getURL("http://www.pixel2life.com");
}
function menuChoiceFour()
{
       getURL("http://www.kirupa.com");
}
function menuChoiceFive()
{
       getURL("http://www.tutorialized.com");
}
 
NewMenu = new ContextMenu();
NewMenu.hideBuiltInItems();
NewMenu.customItems.push(new ContextMenuItem("toxiclab.org", menuChoiceOne));
NewMenu.customItems.push(new ContextMenuItem("profileKing.org", menuChoiceTwo));
NewMenu.customItems.push(new ContextMenuItem("www.pixel2life.com", menuChoiceThree)); NewMenu.customItems.push(new ContextMenuItem("www.kirupa.com", menuChoiceFour)); NewMenu.customItems.push(new ContextMenuItem("www.tutorialized.com", menuChoiceFive)); this.menu = NewMenu;


If you like to add a more choices to the right click menu, first you must to do is: define a new function named "menuChoicesix" and after that create another line.

NewMenu.customItems.push(new ContextMenuItem("Choice six", menuChoicesix));

We're done, test your movie (Ctrl+Enter).

Download example (26 KB)

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category


Most popular tutorials


Resources Worth visiting


Friends