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.

Example<br />

Add a button instance on the Stage <strong>and</strong> name it myBtn_btn. Draw an oval on the Stage using<br />

the Oval tool that has a stroke <strong>and</strong> fill color. Select Frame 1 <strong>and</strong> add the following<br />

<strong>ActionScript</strong> using the Actions panel:<br />

myBtn_btn.onRelease = function() {<br />

myBtn_btn._highquality = 0;<br />

};<br />

When you click myBtn_btn, the circle's stroke will look jagged. You could add the following<br />

<strong>ActionScript</strong> instead to affect the SWF globally:<br />

_quality = 0;<br />

See also<br />

_quality (Button._quality property), _quality property<br />

menu (Button.menu property)<br />

public menu : ContextMenu<br />

Associates the ContextMenu object contextMenu with the button object my_button. The<br />

ContextMenu class lets you modify the context menu that appears when the user right-clicks<br />

(Windows) or Control-clicks (Macintosh) in Flash Player.<br />

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

Example<br />

The following example assigns a ContextMenu object to a button instance named<br />

myBtn_btn. The ContextMenu object contains a single menu item (labeled "Save...") with an<br />

associated callback h<strong>and</strong>ler function named doSave.<br />

Add the button instance to the Stage <strong>and</strong> name it myBtn_btn.<br />

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

menu_cm.customItems.push(new ContextMenuItem("Save...", doSave));<br />

function doSave(menu:Object, obj:Object):Void {<br />

trace( " You selected the 'Save...' menu item ");<br />

}<br />

myBtn_btn.menu = menu_cm;<br />

Select Control > Test Movie to test the SWF file. With the pointer over myBtn_btn, rightclick<br />

or Control-click. The context menu appears with Save in the menu. When you select<br />

Save from the menu, the Output panel appears.<br />

Button 367

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

Saved successfully!

Ooh no, something went wrong!