MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference page 215

Actionscript language reference
Table of Contents

Advertisement

var showItem = true;
var my_cm:ContextMenu = new ContextMenu(menuHandler);
my_cm.customItems.push(new ContextMenuItem("Hello", itemHandler));
function menuHandler(obj, menuObj) {
if (showItem == false) {
menuObj.customItems[0].enabled = false;
} else {
menuObj.customItems[0].enabled = true;
}
}
function itemHandler(obj, item) {
//...put code here...
trace("selected!");
}
this.menu = my_cm;
When the user right-clicks or Control-clicks the Stage, the custom menu is displayed.
See also
Button.menu, ContextMenu.onSelect, ContextMenu.customItems,
ContextMenu.hideBuiltInItems(), MovieClip.menu,
// Change this to false to remove
TextField.menu
ContextMenu class
215

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents