Contextmenuitem Constructor - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

ContextMenuItem constructor

public ContextMenuItem(caption:String, callbackFunction:Function,
[separatorBefore:Boolean], [enabled:Boolean], [visible:Boolean])
Creates a new ContextMenuItem object that can be added to the
ContextMenu.customItems
Availability: ActionScript 1.0; Flash Player 7
Parameters
- A string that specifies the text associated with the menu item.
caption:String
callbackFunction:Function
item is selected.
separatorBefore:Boolean
bar should appear above the menu item in the context menu. The default value is
[optional] - A Boolean value that indicates whether the menu item is
enabled:Boolean
enabled or disabled in the context menu. The default value is
[optional] - A Boolean value that indicates whether the menu item is
visible:Boolean
visible or invisible. The default value is
Example
This example adds Start and Stop menu items, separated by a bar, to the ContextMenu object
. The
my_cm
startHandler()
is called when Stop is selected. The ContextMenu object is applied to the
stopHandler()
current Timeline.
var my_cm:ContextMenu = new ContextMenu();
my_cm.customItems.push(new ContextMenuItem("Start", startHandler));
my_cm.customItems.push(new ContextMenuItem("Stop", stopHandler, true));
function stopHandler(obj, item) {
trace("Stopping...");
}
function startHandler(obj, item) {
trace("Starting...");
}
this.menu = my_cm;
452
ActionScript classes
array.
- A function that you define, which is called when the menu
[optional] - A Boolean value that indicates whether a separator
.
true
function is called when Start is selected from the context menu;
false
.
true
.

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF