342 Chapter 12: ActionScript Dictionary
Property summary for the ContextMenuItem class
Event handler summary for the ContextMenuItem class
Constructor for the ContextMenuItem class
Availability
Flash Player 7.
Usage
new ContextMenuItem(caption, callbackFunction, [ separatorBefore, [ enabled,
[ visible ] ] ] )
Parameters
caption
A string that specifies the text associated with the menu item.
callbackFunction A function that you define, which is called when the menu item is selected.
separatorBefore A Boolean value that indicates whether a separator bar should appear above
the menu item in the context menu. This parameter is optional; its default value is
false.
enabled A Boolean value that indicates whether the menu item is enabled or disabled in the
context menu. This parameter is optional; its default value is
true.
visible A Boolean value that indicates whether the menu item is visible or invisible. This
parameter is optional; its default value is
true.
Returns
Nothing.
Description
Constructor; creates a new ContextMenuItem object that can be added to the
ContextMenu.customItems array.
Example
This example adds Start and Stop menu items, separated by a bar, to the ContextMenu object
my_cm. The startHandler() function is called when Start is selected from the context menu;
stopHandler() is called when Stop is selected. The ContextMenu object is applied to the
root Timeline.
Property Description
ContextMenuItem.caption Specifies the text displayed in the menu item.
ContextMenuItem.enabled Specifies whether the menu item is enabled or disabled.
ContextMenuItem.separatorBefore Specifies whether a separator bar should appear above the
menu item.
ContextMenuItem.visible Specifies whether the menu item is visible or not.
Event handler Description
ContextMenuItem.onSelect Invoked when the menu item is selected.