Our Swish tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Swish Tutorials Custom Context Menu With Actions
Your Ad Here

Custom Context Menu With Actions


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.



Author's URL: Craig Lowe
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 Swish Tutorials at FlashPerfection.com

Add comments to "Custom Context Menu With Actions"

Only registered users can write comment

No comments yet...