ContextMenuItem
449
Parameters
item
:Object
- A reference to the object (movie clip, button, or selectable text field) that was
under the mouse pointer when the Flash Player context menu was invoked and whose
menu
property is set to a valid ContextMenu object.
item_menu
:Object
- A reference to the ContextMenu object assigned to the
menu
property of
object
.
Example
The following example determines over what type of object the context menu was invoked.
my_cm:ContextMenu = new ContextMenu();
function menuHandler(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;
my_mc.menu = my_cm;
my_btn.menu = my_cm;
ContextMenuItem
Object
|
+-ContextMenuItem
public dynamic class
ContextMenuItem
extends Object
The ContextMenuItem class allows you to create custom menu items to display in the Flash
Player context menu. Each ContextMenuItem object has a caption (text) that is displayed in
the context menu, and a callback handler (a function) that is 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.
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...