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.

Invoked when a button loses keyboard focus. The onKillFocus h<strong>and</strong>ler receives one<br />

parameter, newFocus, which is an object representing the new object receiving the focus. If no<br />

object receives the focus, newFocus contains the value null.<br />

Parameters<br />

newFocus:Object - The object that is receiving the focus.<br />

Example<br />

The following example demonstrates how statements can be executed when a button loses<br />

focus. Create a button instance on the Stage called my_btn <strong>and</strong> add the following<br />

ActionScript to Frame 1 of the Timeline:<br />

this.createTextField("output_txt", this.getNextHighestDepth(), 0, 0, 300,<br />

200);<br />

output_txt.wordWrap = true;<br />

output_txt.multiline = true;<br />

output_txt.border = true;<br />

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

output_txt.text = "onKillFocus: "+this._name+newline+output_txt.text;<br />

};<br />

Test the SWF file in a browser window, <strong>and</strong> try using the Tab key to move through the<br />

elements in the window. When the button instance loses focus, text is sent to the output_txt<br />

text field.<br />

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

onPress = function() {}<br />

Invoked when a button is pressed. You must define a function that is executed when the event<br />

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 onPress h<strong>and</strong>ler:<br />

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

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

};<br />

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

onRelease = function() {}<br />

264 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!