MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 337

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Description
Constructor; creates a new ContextMenu object. You can optionally specify an identifier for an
event handler when you create the object. The specified function is called when the user invokes
the context menu, but before the menu is actually displayed. This is useful for customizing menu
contents based on application state or based on the type of object (movie clip, text field, or
button) that the user right-clicks or Control-clicks. (For an example of creating an event handler,
see
ContextMenu.onSelect
Example
The following example hides all the built-in objects in the Context menu. (However, the Settings
and About items still appear, because they cannot be disabled.)
var newMenu = new ContextMenu();
newMenu.hideBuiltInItems();
_root.menu = newMenu;
In this example, the specified event handler,
item (using the
named
showItem
var showItem = false; // Change this to true to see its effect
my_cm = 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) {
}
_root.menu = my_cm;
See also
Button.menu,
ContextMenu.onSelect
ContextMenu.hideBuiltInItems()
ContextMenu.builtInItems
Availability
Flash Player 7.
Usage
my_cm.builtInItems
Description
Property; an object that has the following Boolean properties:
,
rewind
forward_back
menu items from the specified ContextMenu object. These properties are enumerable and are set
to
by default.
true
.)
ContextMenu.customItems
. If
, the custom menu item is disabled; otherwise, it's enabled.
false
, and
. Setting these variables to
print
, enables or disables a custom menu
menuHandler
array) based on the value of a Boolean variable
,
ContextMenu.customItems
, MovieClip.menu,
TextField.menu
,
,
,
,
save
zoom
quality
removes the corresponding
false
ContextMenu.builtInItems
,
,
play
loop
337

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Table of Contents