How to use key events in Flash applications for samsung smart TV?
There are two ways that key events can be used:
- handling the keys directly in Flash
- handling the keys in Javascript and calling Flash functions using the ExternalInterface library
Tips to choose one of this methods:
- If there are many complicated animations in the app, then using the second method may slow it down, beacuse ExternalInterface takes a lot of memory to process.
- When using method 1., not all remote keys can be interpreted by the Flash keyhandler. Only the following keys can be handled correctly:
- navigation keys
- color keys
- playback keys
- numeric keys
- return and exit keys
If you need to use other keys, it can be done only through ExternalInterface.
- The only way to implement volume control in method 1. is unregistering the volume keys in Javascript, so that the native TV handling can be done.
- When using method 2., the volume control can be implemented within the Flash app, or unregistered as above.
When using method 1, Here are the keycodes for flash keyHandler,
Keys | KeyCode |
1 | 49 |
2 | 50 |
3 | 51 |
4 | 52 |
5 | 53 |
6 | 54 |
7 | 55 |
8 | 56 |
9 | 57 |
0 | 48 |
pre-ch | |
vol- | |
vol+ | |
info | |
mute | |
ch+ | |
ch- | |
chlist | |
menu | 77 |
fav.CH | |
tools | 84 |
return | 35 |
up | 38 |
down | 40 |
right | 39 |
left | 37 |
enter | 13 |
smarthub | |
exit | 36 |
red | 34 |
green | 32 |
yello | 8 |
blue | 33 |
rewind | 67 |
pause | 80 |
forward | 68 |
rec | |
play | 65 |
stop | 66 |