Today i´ll show you how to build custom right click menu in Flash. This is the 2nd tutorial in 20 tutorials marathon.
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:
Code:
function menuChoiceOne()
{
getURL("http://www.google.com");
}
function menuChoiceTwo()
{
getURL("http://www.talk-mania.com");
}
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("Google", menuChoiceOne));
NewMenu.customItems.push(new ContextMenuItem("Talk-Mania", menuChoiceTwo));
NewMenu.customItems.push(new ContextMenuItem("Pixel2Life", menuChoiceThree));
NewMenu.customItems.push(new ContextMenuItem("Kirupa", menuChoiceFour));
NewMenu.customItems.push(new ContextMenuItem("Tutorialized", 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).