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.

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

the function on the timeline or in a class file that extends the MovieClip class or is linked to a<br />

symbol in the library.<br />

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

Example<br />

The following example defines a function for the onRollOver() method that sends a<br />

trace() action to the Output panel:<br />

my_mc.onRollOver = function () {<br />

trace("onRollOver called");<br />

}<br />

onSetFocus (MovieClip.onSetFocus h<strong>and</strong>ler)<br />

onSetFocus = function(oldFocus:Object) {}<br />

Invoked when a movie clip receives keyboard focus. The oldFocus parameter is the object<br />

that loses the focus. For example, if the user presses the Tab key to move the input focus from<br />

a movie clip to a text field, oldFocus contains the movie clip instance.<br />

If there is no previously focused object, oldFocus contains a null value.<br />

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

the function on the timeline or in a class file that extends the MovieClip class or is linked to a<br />

symbol in the library.<br />

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

Parameters<br />

oldFocus:Object - The object to lose focus.<br />

Example<br />

The following example displays information about the movie clip that receives keyboard<br />

focus, <strong>and</strong> the instance that previously had focus. Two movie clips, called my_mc <strong>and</strong><br />

other_mc are on the Stage. Add the following <strong>ActionScript</strong> to your AS or FLA document:<br />

my_mc.onRelease = Void;<br />

other_mc.onRelease = Void;<br />

my_mc.onSetFocus = function(oldFocus) {<br />

trace("onSetFocus called, previous focus was: "+oldFocus);<br />

}<br />

Tab between the two instances, <strong>and</strong> information displays in the Output panel.<br />

922 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!