A-C > Button.onKeyDown |  |

Button.onKeyDown

button, button.onKeyDown, onKeyDown

Availability

Flash Player 6.

Usage

    myButton.onKeyDown

Parameters

None.

Returns

Nothing.

Description

Event handler; invoked when a button has keyboard focus and a key is pressed. The `onKeyDown` event is invoked with no parameters. You can use the `Key.getAscii` and `Key.getCode` methods to determine which key was pressed.

You must define a function that executes when the event is invoked.

Example

The following example defines a function for the `onKeyDown` method that sends a `trace` to the Output window:

    myButton.onKeyDown = function () {
    	trace ("onKeyDown called");
    };

See also

`Button.onKeyUp`