03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - 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.

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

};<br />

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

onRollOver = function() {}<br />

Invoked when the button gains focus. This can happen when the user clicks another button<br />

outside of the currently selected button. Invoked when the pointer moves over a button area.<br />

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

Example<br />

In the following example, a function that sends a trace() statement to the Output panel is<br />

defined for the onRollOver h<strong>and</strong>ler:<br />

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

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

};<br />

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

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

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

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

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

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

Parameters<br />

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

Example<br />

The following example demonstrates how you can execute statements when the user of a SWF<br />

file moves focus from one button to another. Create two buttons, btn1_btn <strong>and</strong> btn2_btn,<br />

<strong>and</strong> enter the following ActionScript in Frame 1 of the Timeline:<br />

Selection.setFocus(btn1_btn);<br />

trace(Selection.getFocus());<br />

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

trace(oldFocus._name + "lost focus");<br />

};<br />

Test the SWF file by pressing Control+Enter. Make sure you select Control > Disable<br />

Keyboard Shortcuts if it is not already selected. Focus is set on btn1_btn. When btn1_btn<br />

loses focus <strong>and</strong> btn2_btn gains focus, information is displayed in the Output panel.<br />

266 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!