top

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

NameValueDescription
UP29460up key
DOWN29461down key
LEFT4left key
5right key
ENTER29443enter key
TOOLS75tools key
RETURN88return key
EXIT45exit key
INFO31info key
RED108red key
GREEN20green key
YELLOW21yellow key
BLUE22blue key
N017number key 0
N1101number key 1
N298number key 2
N36number key 3
N48number key 4
N59number key 5
N610number key 6
N712number key 7
N813number key 8
N914number key 9
PRECH259PRE-CH key
VOL_UP7volume up
VOL_DOWN11volume down
MUTE27volume mute
CH_UP68channel up
CH_DOWN65channel down
REW69rewind key
PAUSE74pause key
FF72fast forward key
REC192record key
PLAY71play key
STOP70stop key

Methods

preventDefault

Description
This function prevents the default key action.
Parameters
none
Return■Void
Emulator SupportN
SDK ConstraintNone
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 SupportN
SDK ConstraintNone
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 SupportN
SDK ConstraintNone
Example
sf.key.unregisterKey(sf.key.VOL_DOWN);