ContextMenuItem class
341
Example
The following example determines over what type of object the context menu was invoked.
my_cm = new ContextMenu();
menuHandler = function (obj:Object, menu:ContextMenu) {
if(obj instanceof MovieClip) {
trace("Movie clip: " + obj);
}
if(obj instanceof TextField) {
trace("Text field: " + obj);
}
if(obj instanceof Button) {
trace("Button: " + obj);
}
}
my_cm.onSelect = menuHandler;
ContextMenuItem class
Availability
Flash Player 7.
Description
You use the ContextMenuItem class to create custom menu items to display in the Flash Player
context menu. Each ContextMenuItem object has a caption (text) that’s displayed in the context
menu and a callback handler (a function) that’s invoked when the menu item is selected. To add a
new context menu item to a context menu, you add it to the
customItems
array of a
ContextMenu object.
You can enable or disable specific menu items, make items visible or invisible, or change the
caption or callback handler associated with a menu item.
Custom menu items appear at the top of the context menu, above any built-in items. A separator
bar always divides custom menu items from built-in items. You can add no more than 15 custom
items to the Flash Player context menu. Each item must contain at least one visible character—
control characters, newlines, and other white space characters are ignored. No item can be more
than 100 characters long. Items that are identical to any built-in menu item, or to another custom
item, are ignored, whether the matching item is visible or not. Menu items are compared without
regard to case, punctuation, or white space.
None of the following words can appear in a custom item:
Macromedia, Flash Player,
or
Settings.
Method summary for the ContextMenuItem class
Method
Description
ContextMenuItem.copy()
Returns a copy of the specified ContextMenuItem object.
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...