EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Contextmenuitem Constructor

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
452 ActionScript classes
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 array.
Availability: ActionScript 1.0; Flash Player 7
Parameters
caption:String - A string that specifies the text associated with the menu item.
callbackFunction:Function - A function that you define, which is called when the menu
item is selected.
separatorBefore:Boolean [optional] - A Boolean value that indicates whether a separator
bar should appear above the menu item in the context menu. The default value is
false.
enabled:Boolean [optional] - A Boolean value that indicates whether the menu item is
enabled or disabled in the context menu. The default value is
true.
visible:Boolean [optional] - A Boolean value that indicates whether the menu item is
visible or invisible. The default value is
true.
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
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;

Table of Contents

Related product manuals