Flash CS3 Documentation |
|||
| Developing Flash Lite 1.x Applications > Creating Interactivity and Navigation > Handling key events > Writing a key handler script | |||
To handle a keypress event, you attach an on(keyPress "key") handler to a button instance, where key is a supported key event name. For example, the following code, attached to a button instance on the Stage, executes when the user presses the Right Arrow key on their device:
on(keyPress "<Right>") {
trace("You pressed the right arrow key");
}
The following table lists the ActionScript keypress event that Flash Lite generates in response to the user pressing a key on the device:
|
Device key |
ActionScript key event |
Availability |
|---|---|---|
|
0-9, *, # |
0, 1, 2, 3, 4, 5, 6, 7, 8, -9, *, #
|
All devices |
|
Select key |
<Enter>
|
All devices |
|
Left Arrow key |
<Left>
|
Devices that support four-way navigation, only. |
|
Right Arrow key |
<Right>
|
Devices that support four-way navigation, only. |
|
Up Arrow key |
<Up>
|
Devices that support four-way navigation, only. |
|
Down Arrow key |
<Down>
|
Devices that support four-way navigation, only. |
|
Left soft key |
<PageUp>
|
Devices that support the |
|
Right soft key |
<PageDown>
|
Devices that support the |
Flash CS3