518
Chapter 7: ActionScript for Flash
Property summary for the ContextMenu class
Event handler summary for the ContextMenu class
Constructor for the ContextMenu class
Availability
Flash Player 7.
Usage
new ContextMenu ([
callBackFunction
])
Parameters
callBackFunction
A reference to a function that is called when the user right-clicks or
Control-clicks, before the menu is displayed. This parameter is optional.
Returns
A reference to a ContextMenu object.
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) or the Timeline 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:ContextMenu = new ContextMenu();
newMenu.hideBuiltInItems();
this.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.
Property
Description
ContextMenu.builtInItems
An object whose members correspond to built-in context
menu items.
ContextMenu.customItems
An array, undefined by default, that contains
ContextMenuItem objects.
Property
Description
ContextMenu.onSelect
Invoked before the menu is displayed.
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...