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.

onDragOver (Button.onDragOver h<strong>and</strong>ler)<br />

onDragOver = function() {}<br />

Invoked when the user presses <strong>and</strong> drags the mouse button outside <strong>and</strong> then over the button.<br />

You must define a function that executes when the event h<strong>and</strong>ler is invoked.<br />

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

Example<br />

The following example defines a function for the onDragOver h<strong>and</strong>ler that sends a trace()<br />

statement to the Output panel. Create a button called my_btn on the Stage <strong>and</strong> enter the<br />

following <strong>ActionScript</strong> on the Timeline:<br />

my_btn.onDragOut = function() {<br />

trace("onDragOut: "+this._name);<br />

};<br />

my_btn.onDragOver = function() {<br />

trace("onDragOver: "+this._name);<br />

};<br />

When you test the SWF file, drag the pointer off the button instance. Then, while holding<br />

the mouse button, drag onto the button instance again. Notice that the Output panel tracks<br />

your movements.<br />

See also<br />

onDragOut (Button.onDragOut h<strong>and</strong>ler)<br />

onKeyDown (Button.onKeyDown h<strong>and</strong>ler)<br />

onKeyDown = function() {}<br />

Invoked when a button has keyboard focus <strong>and</strong> a key is pressed. The onKeyDown event<br />

h<strong>and</strong>ler is invoked with no parameters. You can use the Key.getAscii() <strong>and</strong><br />

Key.getCode() methods to determine which key was pressed. You must define a function<br />

that executes when the event h<strong>and</strong>ler is invoked.<br />

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

Example<br />

In the following example, a function that sends text to the Output panel is defined for the<br />

onKeyDown h<strong>and</strong>ler. Create a button called my_btn on the Stage, <strong>and</strong> enter the following<br />

<strong>ActionScript</strong> in a frame on the Timeline:<br />

my_btn.onKeyDown = function() {<br />

trace("onKeyDown: "+this._name+" (Key: "+getKeyPressed()+")");<br />

};<br />

Button 369

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

Saved successfully!

Ooh no, something went wrong!