Wiley samsung smarttv application development 111882802x

Page 86

Switching Between Scenes When the index.html file is loaded into the SmartTV’s internal browser, the first scene will be displayed on the TV screen according to the application scenario. The activated scene will dominate the focus. If a user moves the focus and selects another scene, then the application activates the new scene and deactivates the previous scene. The activated scene is displayed and the deactivated scene is hidden. Many other methods can be used to switch scenes on a SmartTV, such as using dynamic layers or pop-up style sublayers. Be careful not to open too many unnecessary scenes; conserve limited physical memory capacity of a TV. When a scene is switched, the focus also must be moved. Be careful not to lose the focus by switching to no existing scene, or to a scene of which its parent element is hidden. The next example shows switching between the GalleryScene and its sublayer, SurveyScene. gallery.js GalleryScene.load = function() { // GalleryScene }; GalleryScene.keyDown = function() { var keyCode = event.keyCode; switch(keyCode) { // Activate SurveyScene case tvKey.KEY_ENTER: SurveyScene.load(); SurveyScene.show(); SurveyScene.focus(); break; } };

84

Samsung SmartTV Application Development: A Complete Guide


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.