ContextMenu.builtInItems
337
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,
menuHandler
, enables or disables a custom menu
item (using the
ContextMenu.customItems
array) based on the value of a Boolean variable
named
showItem
. If
false
, the custom menu item is disabled; otherwise, it’s enabled.
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.customItems
,
ContextMenu.hideBuiltInItems()
,
MovieClip.menu
,
TextField.menu
ContextMenu.builtInItems
Availability
Flash Player 7.
Usage
my_cm
.builtInItems
Description
Property; an object that has the following Boolean properties:
save
,
zoom
,
quality
,
play
,
loop
,
rewind
,
forward_back
, and
. Setting these variables to
false
removes the corresponding
menu items from the specified ContextMenu object. These properties are enumerable and are set
to
true
by default.
Summary of Contents for FLASH MX 2004 - ACTIONSCRIPT
Page 1: ...ActionScript Reference Guide...
Page 8: ...8 Contents...
Page 12: ......
Page 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Page 54: ...54 Chapter 2 ActionScript Basics...
Page 80: ...80 Chapter 3 Writing and Debugging Scripts...
Page 82: ......
Page 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Page 112: ......
Page 120: ...120 Chapter 6 Using the Built In Classes...
Page 176: ......
Page 192: ...192 Chapter 10 Working with External Data...
Page 202: ...202 Chapter 11 Working with External Media...
Page 204: ......
Page 782: ...782 Chapter 12 ActionScript Dictionary...
Page 793: ...Other keys 793 221 222 Key Key code...
Page 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Page 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Page 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Page 816: ...816 Index...