And here’s yet another design consideration for AIR for TV applications. (This and other tips will be incorporated soon into Adobe online documentation).
Users typically interact with your AIR for TV application using a remote control. The good news is that the way you handle remote control key input is the same way you handle key input from a keyboard on a desktop application. Specifically, handle the event KeyboardEvent.KEY_DOWN.
The keys on the remote control map to ActionScript constants. For example, the keys on the directional keypad on a remote control map as follows:
|Remote control’s directional keypad key
||ActionScript 3.0 constant
|OK or Select||Keyboard.ENTER|
AIR 2.5 added many other Keyboard constants to support remote control input. For a complete list, see the Keyboard class in the ActionScript 3.0 Reference for the Adobe Flash Platform.
To ensure your application works on as many devices as possible, Adobe recommends the following:
- Use only the directional keypad keys, if possible.
Different remote control devices have different sets of keys. However, they typically always have the directional keypad keys.
For example, a remote control for a Blu-ray player does not typically have a “channel up” and “channel down” key. Even keys for play, pause, and stop are not on all remote controls.
- Use the Menu and Info keys if the application needs more than the directional keypad keys.
The Menu and Info keys are the next most common keys on remote controls.
- Consider the frequent usage of universal remote controls.
Even if you are creating an application for a particular device, realize that many users do not use the remote control that comes with the device. Instead, they use a universal remote control. Also, users do not always program their universal remote control to match all the keys on the device’s remote control. Therefore, using only the most common keys is advisable.
- Make sure that the user can always escape a situation using one of the directional keypad keys.
Sometimes your application has a good reason to use a key that is not one of the most common keys on remote controls. Providing an escape route with one of the directional keypad keys makes your application behave gracefully on all devices.
- Do not require mouse input.
Obviously, a television doesn’t have a mouse. However, if you are converting desktop applications to run on televisions, make sure that you modify the application to not expect mouse input. These modifications include changes to event handling and changes to instructions to the user. For example, don’t overlook changing an application’s startup screen if it displays text that says “Click to start”.
For more information on key input handling, see Capturing keyboard input in the ActionScript 3.0 Developer’s Guide.