User Guide

148 Chapter 2: ActionScript Language Reference
Button.onKillFocus
Availability
Flash Player 6.
Usage
my_btn.onKillFocus = function (newFocus:Object) : Void {
// your statements here
}
Parameters
newFocus
The object that is receiving the focus.
Returns
Nothing.
Description
Event handler; invoked when a button loses keyboard focus. The onKillFocus handler receives
one parameter,
newFocus, which is an object representing the new object receiving the focus. If
no object receives the focus,
newFocus contains the value null.
Example
The following example demonstrates how statements can be executed when a button loses focus.
Create a button instance on the Stage called my_btn and add the following ActionScript to Frame
1 of the Timeline:
this.createTextField("output_txt", this.getNextHighestDepth(), 0, 0, 300,
200);
output_txt.wordWrap = true;
output_txt.multiline = true;
output_txt.border = true;
my_btn.onKillFocus = function() {
output_txt.text = "onKillFocus: "+this._name+newline+output_txt.text;
};
Test the SWF file in a browser window, and try using the Tab key to move through the elements
in the window. When the button instance loses focus, text is sent to the
output_txt text field.