
Button
283
Parameters
newFocus
:
Object
- The object that is receiving the focus.
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+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.
onPress (Button.onPress handler)
onPress = function() {}
Invoked when a button is pressed. You must define a function that is executed when the event
handler is invoked.
Availability:
ActionScript 1.0; Flash Lite 2.0
Example
In the following example, a function that sends a trace() statement to the Output panel is
defined for the
onPress
handler:
my_btn.onPress = function () {
trace ("onPress called");
};
onRelease (Button.onRelease handler)
onRelease = function() {}
Invoked when a button is released. You must define a function that is executed when the event
handler is invoked.
Availability:
ActionScript 1.0; Flash Lite 2.0
Summary of Contents for Flash Lite 2
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...