플래시 AS3.0 삼성 스마트 TV (스마트 허브) IME UI 에디터 튜토리얼 또는 여러 튜토리얼 모음
=================================
=================================
=================================
Input
The application has an input element, two labels and a helpbar. The Input element has a keypad and a text box. The input given using the key pad gets typed in the text box. The return function of the Input element prints the returned value in the text box.
- Create a project that has an Input component, two labels, and a helpbar.In the code below, the portion shown in bold is the user defined code. The rest is generated automatically.
- function SceneScene1(options) { this.options = options; var ime_input_01 = null; } SceneScene1.prototype.initialize = function () { $('#svecLabel_1').sfLabel({text:'Input text', width:'131px'}); $('#svecLabel_2').sfLabel({text:'text here', width:'131px'}); $('#svecKeyHelp_IIZH').sfKeyHelp({ 'leftright' : 'Call the IME' , 'Enter' : 'Input text', 'return' : 'Return' }); // Define helpbar ime_input_01 = new IMEShell("input_01", callback_input_01); }
- The IME is automatically initialized. The helpbar is initialized with the items for which help is provided.
- When the Right or Left key is pressed, the focus is placed on the input element, and the text can be typed in using the keypad of the input element.
SceneScene1.prototype.handleKeyDown = function (keyCode) { switch (keyCode) { case $.sfKey.LEFT: case $.sfKey.RIGHT: document.getElementById("input_01").focus(); // set the focus on the text box of the IME break; case $.sfKey.UP: break; case $.sfKey.DOWN: break; case $.sfKey.ENTER: break; } }
- Press the Enter key to call the callback function. The callback function returns the value entered in the text box. This text appears on the label element. Specify the key event on which the value has to be returned in the callback function as follows:
function callback_input_01(cb){ cb.setKeyFunc($.sfKey.ENTER, function(){ $('#svecLabel_2').html(document.getElementById("input_01").value); $.sf.returnFocus(); }); //setKeyFunc is an inbuilt function of the IME taking 2 parameters. The first is the key event and the second is a function wherein the user can place some specific task to be executed during callback. }
출처: http://www.samsungdforum.com/Guide/View/Developer_Documentation/Samsung_SmartTV_Developer_Documentation_2.5/JavaScript/Input_Control/Tutorial_Using_IME_(Input_Method_Editor)/Task_An_Application_with_Text_Input_Capability
Handling Remote Control Key Events
If a TV user presses any button on the remote control, a keydown event occurs. This event is passed to an element receiving focus, and if the element has a registered function in the onkeydown property, that function is executed. The function is registered using event.keyCode.
All the remote control keys must be defined by member variables of the tvKeyValue object as follows:
- Insert an element that will have focus in the index.html file:
<a href='javascript:void(0);' id='anchor' onkeydown='Main.keyDown();'></a>
- Create a function to be registered in the onkeydown property:
Main.keyDown = function(){ // Key handler var keyCode = event.keyCode; alert("Main Key code : " + keyCode); switch (keyCode) { case tvKey.KEY_LEFT: /** * Code for Left key event! */ break; case tvKey.KEY_RIGHT: break; case tvKey.KEY_UP: break; case tvKey.KEY_DOWN: break; case tvKey.KEY_ENTER: break; case tvKey.KEY_RETURN: break; } }
Remote control keys for applications
If you access an application, the Application Manager registers basic keys relevant to it. If a key event registered in an application occurs, it is loaded to the application. However, if the key is not registered in the application, the event is not loaded to the application. If an unregistered key is executed, the TV system closes the application and TV functions become available. For example, when an application which has no registered volume key is running, and the volume key on remote control is pressed, the working application is forcibly closed and volume banner appears on TV screen.
The Application Manager registers key sets as stated below in order for the application to use keys. When the <fullwidget> tag value in the config.xml file is ‘y’ and the full-screen application keyset is ‘n’, a single-wide application is registered.
Full- screen Application |
Single-wide Application |
|
---|---|---|
KEY_VOL_UP KEY_VOL_DOWN KEY_MUTE KEY_TOOLS KEY_INFO KEY_EMODE KEY_DMA KEY_MENU KEY_SOURCE KEY_PRECH KEY_FAVCH KEY_CHLIST KEY_DMA KEY_TTX_MIX KEY_GUIDE KEY_SUBTITLE KEY_ASPECT KEY_DOLBY_SRR KEY_MTS KEY_PANEL_CH_UP KEY_PANEL_CH_DOWN KEY_PANEL_VOL_UP KEY_PANEL_VOL_DOWN KEY_PANEL_ENTER KEY_PANEL_SOURCE KEY_PANEL_MENU |
KEY_1 KEY_2 KEY_3 KEY_4 KEY_5 KEY_6 KEY_7 KEY_8 KEY_9 KEY_0 KEY_WHEELDOWN KEY_WHEELUP KEY_RED KEY_GREEN KEY_YELLOW KEY_BLUE KEY_RW KEY_PAUSE KEY_FF KEY_PLAY KEY_STOP KEY_ENTER KEY_RETURN KEY_EXIT |
KEY_WHEELDOWN KEY_WHEELUP KEY_RED KEY_GREEN KEY_YELLOW KEY_BLUE KEY_RW KEY_PAUSE KEY_FF KEY_PLAY KEY_STOP KEY_ENTER KEY_RETURN KEY_EXIT |
Note: Each application registers/unregisters keys additionally by utilizing the registKey() method of the Plugin objects common module.
Key registration/unregistration should be done after the window.onshow event. The keys registered/unregistered after the window.onshow event are processed normally, but those before the window.onshow event may be ignored.
Register a function executed in window.onshow prior to calling this method because window.onshow event happens after calling the sendReadyEvent() method of the Widget common module. An example is shown below:
var WIDGET = new Common.API.Widget(); // For sendReadyEvent() var TVKEY = new Common.API.TVKeyValue(); // Remote controller key value object var PLUGIN = new Common.API.Plugin(); // Plugin common module Main.onLoad = function(){ window.onshow = function(){ // register function will be run onshow event PLUGIN.registKey(TVKEY.KEY_VOL_UP); PLUGIN.registKey(TVKEY.KEY_VOL_DOWN); } WIDGET.sendReadyEvent(); /** * code */ }
The time of key registration/unregistration after the window.onshow event does not matter.
=================================
=================================
=================================