.

The Actionscript

The actions in Frame 1 are as follows:

var myContextMenu = new ContextMenu();
    myContextMenu.hideBuiltInItems();
    var spin = new ContextMenuItem("Spin Spin Spin!!!", mySpin);
    myContextMenu.customItems.push(spin);
    function mySpin() {
        webwasp.gotoAndPlay(2);
    }
    webwasp.menu = myContextMenu;
 


ActionScript Explained:

var myContextMenu = new ContextMenu();


This creates a new object from the ContextMenu class.


myContextMenu.hideBuiltInItems();


This hides the standard items that are in the Flash context menu


var spin = new ContextMenuItem("Spin Spin Spin!!!", mySpin);


Creates the text label that will be visible in the new Context menu and links this item to the function: mySpin


myContextMenu.customItems.push(spin);


Places the new item created in the variable spin into the context menu



function mySpin() {
    webwasp.gotoAndPlay(2); }


When you click on the Context menu item, anything listed in this function will be executed.


webwasp.menu = myContextMenu;


Associates all of the above with the movie clip called webwasp.




No comments found ! Click here to be the first adding comments for this tutorial!