website promotion banner
eturnkeys
Your Ad Here
Flash & Swish  Home Flash & Swish Swish Tutorials Custom Context Menu With Actions
rss

Custom Context Menu With Actions

Author: Craig Lowe More by this author


Example:

Controls

Right click ont the movie and select one of the options from the context menu.

First Of All

Open SwishMax and set the stage size, i have used 210 x 250 for the example.

Step. 1

Create a sprite and call it one, inside the sprite, create your content.

I have just selected the text tool and wrote sprite 1 loaded, just for a visual representation.

Step. 2

Follow step 1 but this time call the sprite two and add your content for the sprite again i have chosen the text tool and wrote sprite 2 loaded for the visual representation.

Once you have created you two sprites add the following script to Scene_1

onLoad () {
var rootMenu = new ContextMenu();
//code for sprite 1
rootMenu.hideBuiltInItems();
_root.menu = rootMenu;
var testFunction1 = function () {
one.gotoAndPlay(2);
};
var newItem01 = new ContextMenuItem("Load Sprite 1", testFunction1);
rootMenu.customItems.push(newItem01);
_root.menu = rootMenu;
//code for sprite 2
rootMenu.hideBuiltInItems();
_root.menu = rootMenu;
var testFunction2 = function () {
two.gotoAndPlay(2);
};
var newItem02 = new ContextMenuItem("Load Sprite 2", testFunction2);
rootMenu.customItems.push(newItem02);
_root.menu = rootMenu;
}
onFrame (1) {
stop();
}

Now Press Ctrl+T to test it working.




Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Custom Context Menu With Actions"