Developing Flash Lite 2.x and 3.0 Applications

Handling button events

You can use buttons to quickly add interactivity to your Flash Lite applications. Flash Lite supports the same button events as Flash Player on desktop computers, although some events (for example, onDragOut) are only available on devices that have a mouse or stylus interface. On devices that have a keypad interface only, a button must have keypad focus before it will generate any events.

Flash Lite supports the following ActionScript button events:

Button event

Description

onDragOut

Supported only on devices that have a mouse or stylus. Invoked when the user presses the mouse button over the button and the pointer is then dragged outside of the button.

onDragOver

Supported only on devices that have a mouse or stylus. Invoked when the user presses and drags the mouse button outside and then over the button.

onKeyDown

Invoked when the button has focus and a key is released.

onKeyUp

Invoked when the button has focus and a key is pressed.

onKillFocus

Invoked when focus is removed from a button.

onPress

Invoked when the user presses the select key on the device when the button has focus.

onRelease

Invoked when the user releases the select key on the device when the button has focus.

onReleaseOutside

Invoked when the mouse button is released while the pointer is outside the button after the button is pressed while the pointer is inside the button.

onRollOut

Invoked when a button loses focus.

onRollOver

Invoked when a button receives focus.

onSetFocus

Invoked when a button has input focus and a key is released.

The following procedure demonstrates how to create a simple application that handles button events. For an example of using buttons to create a menu, see Create a simple menu using buttons and default navigation.