03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

this.menu = my_cm;<br />

ContextMenuItem constructor<br />

public ContextMenuItem(caption:String, callbackFunction:Function,<br />

[separatorBefore:Boolean], [enabled:Boolean], [visible:Boolean])<br />

Creates a new ContextMenuItem object that can be added to the<br />

ContextMenu.customItems array.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 7<br />

Parameters<br />

caption:String - A string that specifies the text associated with the menu item.<br />

callbackFunction:Function - A function that you define, which is called when the menu<br />

item is selected.<br />

separatorBefore:Boolean [optional] - A Boolean value that indicates whether a separator<br />

bar should appear above the menu item in the context menu. The default value is false.<br />

enabled:Boolean [optional] - A Boolean value that indicates whether the menu item is<br />

enabled or disabled in the context menu. The default value is true.<br />

visible:Boolean [optional] - A Boolean value that indicates whether the menu item is<br />

visible or invisible. The default value is true.<br />

Example<br />

This example adds Start <strong>and</strong> Stop menu items, separated by a bar, to the ContextMenu object<br />

my_cm. The startH<strong>and</strong>ler() function is called when Start is selected from the context menu;<br />

stopH<strong>and</strong>ler() is called when Stop is selected. The ContextMenu object is applied to the<br />

current Timeline.<br />

var my_cm:ContextMenu = new ContextMenu();<br />

my_cm.customItems.push(new ContextMenuItem("Start", startH<strong>and</strong>ler));<br />

my_cm.customItems.push(new ContextMenuItem("Stop", stopH<strong>and</strong>ler, true));<br />

function stopH<strong>and</strong>ler(obj, item) {<br />

trace("Stopping...");<br />

}<br />

function startH<strong>and</strong>ler(obj, item) {<br />

trace("Starting...");<br />

}<br />

this.menu = my_cm;<br />

copy (ContextMenuItem.copy method)<br />

public copy() : ContextMenuItem<br />

458 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!