SF.KEY
** This class will not be supported in 2015.
All functionalities of sf.key class are more improved, integrating with CAPH. Therefore sf.key class is not supported since 2015 Smart TV. To use functions of sf.key class, refer to here.
This class defines the key event ENUM values and functions.
Add the following line for sf.key class into a html file your own : <script type="text/javascript" src="$MANAGER_WIDGET/Common/af/2.0.0/loader.js"></script> |
You can declare sf.key class like this : ex) var key = sf.key; |
Constants
Name | Value | Description |
UP | 29460 | up key |
DOWN | 29461 | down key |
LEFT | 4 | left key |
RIGHT | 5 | right key |
ENTER | 29443 | enter key |
TOOLS | 75 | tools key |
RETURN | 88 | return key |
EXIT | 45 | exit key |
INFO | 31 | info key |
RED | 108 | red key |
GREEN | 20 | green key |
YELLOW | 21 | yellow key |
BLUE | 22 | blue key |
N0 | 17 | number key 0 |
N1 | 101 | number key 1 |
N2 | 98 | number key 2 |
N3 | 6 | number key 3 |
N4 | 8 | number key 4 |
N5 | 9 | number key 5 |
N6 | 10 | number key 6 |
N7 | 12 | number key 7 |
N8 | 13 | number key 8 |
N9 | 14 | number key 9 |
PRECH | 259 | PRE-CH key |
VOL_UP | 7 | volume up |
VOL_DOWN | 11 | volume down |
MUTE | 27 | volume mute |
CH_UP | 68 | channel up |
CH_DOWN | 65 | channel down |
REW | 69 | rewind key |
PAUSE | 74 | pause key |
FF | 72 | fast forward key |
REC | 192 | record key |
PLAY | 71 | play key |
STOP | 70 | stop key |
Methods
preventDefault | ||
Description | ||
This function prevents the default key action. | ||
Parameters | none | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.key.preventDefault(); |
registerKey | ||
Description | ||
This function registers the key for getting events of the key (keydown, keyup, and so on). Each key has a default action. For example, the VOL_UP key raises the volume level. Keys must be registered for receiving key events instead of default actions. If the VOL_UP key is registered, the keydown event is received for the key and it does not work for raising the volume. Almost all the keys are registered by Application Manager when the application is launched. So this function need not be called in most cases. Call this function to receive the event for keys not registered by default. | ||
Parameters | ■keyCode - Number - The keycode to be registered | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.key.registerKey(sf.key.VOL_DOWN); |
unregisterKey | ||
Description | ||
This function unregisters the specified key. | ||
Parameters | ■keyCode - Number - The keycode to be unregistered | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.key.unregisterKey(sf.key.VOL_DOWN); |