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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Creates <strong>and</strong> returns a copy of the specified ContextMenuItem object. The copy includes all<br />

properties of the original object.<br />

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

Returns<br />

ContextMenuItem - A ContextMenuItem object.<br />

Example<br />

This example creates a new ContextMenuItem object named original_cmi with the caption<br />

Pause <strong>and</strong> a callback h<strong>and</strong>ler set to the function onPause. The example then creates a copy of<br />

the ContextMenuItem object <strong>and</strong> assigns it to the variable copy_cmi.<br />

var original_cmi:ContextMenuItem = new ContextMenuItem("Pause", onPause);<br />

function onPause(obj:Object, menu:ContextMenu) {<br />

trace("pause me");<br />

}<br />

var copy_cmi:ContextMenuItem = original_cmi.copy();<br />

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

my_cm.customItems.push(original_cmi);<br />

my_cm.customItems.push(copy_cmi);<br />

my_mc.menu = my_cm;<br />

enabled (ContextMenuItem.enabled property)<br />

public enabled : Boolean<br />

A Boolean value that indicates whether the specified menu item is enabled or disabled. By<br />

default, this property is true.<br />

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

Example<br />

The following example creates two new context menu items: Start <strong>and</strong> Stop. When the user<br />

selects Start, the number of milliseconds from when the SWF file started is traced. Start is<br />

then disabled in the menu. When Stop is selected, the number of milliseconds that have<br />

elapsed since the SWF file started is traced. The Start menu item is re-enabled <strong>and</strong> the Stop<br />

menu item is disabled.<br />

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

var startMenuItem:ContextMenuItem = new ContextMenuItem("Start",<br />

startH<strong>and</strong>ler);<br />

startMenuItem.enabled = true;<br />

ContextMenuItem 459

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

Saved successfully!

Ooh no, something went wrong!