SF.SCENE
** This class will not be supported in 2015.
All functionalities of sf.scene class are more improved, integrating with CAPH. Therefore sf.scene class is not supported since 2015 Smart TV. To use functions of sf.scene class, refer to here.
This class defines the Scene Manager functions.
Add the following line for sf.scene 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.scene class like this : ex) var scene = sf.scene; |
Contents
Methods
clearKeyHandler | ||
Description | ||
This function clear all keyhandler. | ||
Parameters | none | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.scene.clearKeyHandler() |
focus | ||
Description | ||
This function binds the framework’s keyHandler to the Scene keyHandler. The focused Scene keyHandler is used when remote key pressed. When used, the handleFocus method of the current scene and the handleBlur method of the scene that was previously focused are called. When the user presses a key on the remote control, the handleKeyDown method of the focused scene is called. | ||
Parameters | ■key - String - Scene ID ■data (Optional) - Any type - Data to be passed to the Scene. Use Array or JavaScript object to pass multiple values. | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.scene.focus(SCENE_ID); |
get | ||
Description | ||
This function gets the Scene instance. | ||
Parameters | ■key - String - Scene ID | |
Return | ■Object - Scene instance | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.scene.get('Popup').popupcallback(rlt); |
getFocused | ||
Description | ||
This function gets current focused Scene ID. If the Scene ID is specified, gets whether the scene is focused. | ||
Parameters | ■sceneid (Optional) - String - If this “sceneid” is specified, get whether the Scene is focused or not. | |
Return | [if “sceneid” is not passed] ■String - Current focused scene ID. [if “sceneid” is passed] ■Boolean - true : the scene is focused - false : the scene is not focused | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
var scene = sf.scene.getFocused(); |
getKeyHandler | ||
Description | ||
This function gets keyhandler based on scene ID. | ||
Parameters | none | |
Return | ■Object - Object containing the 'handler' and 'context' of the handler. | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.scene.getKeyHandler(); |
getState | ||
Description | ||
This function gets status(visible, hidden, focused) of the Scene. | ||
Parameters | ■sceneID - String - scene ID | |
Return | ■String - status of the scene | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
var a = sf.scene.getState("Env"); |
getVisible | ||
Description | ||
This function gets whether the Scene is visible or not. | ||
Parameters | ■sceneID - String - scene ID | |
Return | ■Boolean - true : the scene is visible - false : the scene is not visible. | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
var a = sf.scene.getVisible("PIG") |
hide | ||
Description | ||
This function hides the Scene. When used, the handleHide method of the scene is called. The container DIV (id: Scene[SceneID]) of the Scene is hidden by setting the visibility property as hidden. | ||
Parameters | ■key - String - Scene ID ■data (Optional) - Any type - Data to be passed to the Scene. Use Array or JavaScript object to pass multiple values. | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.scene.hide(SCENE_ID); |
loadScenes | ||
Description | ||
This function loads scenes and initialize instances. | ||
Parameters | ■scenes - Array<String> - Array of scene id to load ■callback - Function - Callback function to be called when the scenes are loaded. | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.scene.loadScenes(['Main', 'TitleList'], function () { // The scenes are loaded }); |
popKeyHandler | ||
Description | ||
This function deletes keyhandler on the top. | ||
Parameters | none | |
Return | ■Object - Object containing the 'handler' and 'context' of the handler. | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.scene.popKeyHandler(); |
pushKeyHandler | ||
Description | ||
This function registers keyhandler and get handler ID. | ||
Parameters | ■handler - Function - key handler to push. ■options - Object - Object containing options of handler. - 'context' : (Object) context of the handler. | |
Return | ■Number - ID number of the registered handler. | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
var id = sf.scene.pushKeyHandler(function () {}, {context: this}); |
removeKeyHandler | ||
Description | ||
This function deletes keyhandler. | ||
Parameters | ■id - Number - Handler's id to remove. | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
var id = sf.scene.pushKeyHandler(function () {}, {context: this}); sf.scene.removeKeyHandler(id); |
returnFocus | ||
Description | ||
This function returns focus to the framework scene manager. | ||
Parameters | none | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.scene.returnFocus(); |
show | ||
Description | ||
This function shows the Scene. When used, the handleShow method of Scene is called. The container DIV (id: Scene[SceneID]) of the Scene is shown by setting the visibility property as visible. If the Scene HTML is not loaded to the body, because the scene is used for the first time, the Scene Manager creates the scene container and the initialize method of the Scene is called. | ||
Parameters | ■key - String - Scene ID ■data (Optional) - Any type - Data to be passed to the Scene. Use Array or JavaScript object to pass multiple values. | |
Return | ■Void | |
Emulator Support | N | |
SDK Constraint | None | |
Example | ||
sf.scene.show(SCENE_ID); |