SWF Based Flash Application Tutorial[V1.00]

  • Published on
    11-Mar-2015

  • View
    297

  • Download
    1

Transcript

SWF based Flash Application TutorialVersion 1.00

Samsung SmartTV@Samsung Electronics Copyright All Rights Reserved

SWF based Application Tutorial

1

Introduction .................................................................................................. 1.1 1.2 Purpose of This Document ............................................................................ Requirements ..........................................................................................

2

Packaging an SWF based Application ..................................................................... 2.1 Structure of SWF based Application .................................................................

3

Creating a Simple SWF based Application ................................................................ 3.1 3.2 Writing a config.xml .................................................................................. Sample SWF File ......................................................................................

@Samsung Electronics Copyright All Rights Reserved

SWF based Application Tutorial

1 Introduction1.1 Purpose of This DocumentThis document is for explaining about the structure of Samsung SmartTV application that uses Adobe SWF file and how to make that application with authored SWF file. This document does not contain the contents about how to make Adobe AIR application and application using Flash Player Plug-In for Samsung SmartTV. Samsung TV Apps SDK does not provide the emulation of SWF based application.

1.2 RequirementsAdobe SWF file can be authored using Flash Authoring Tool. Samsung TV Apps SDK does not provide a method to author SWF file or export as SWF file format. We recommend to use Adobe Flash Authoring Tool for making Adobe SWF file and emulating the run on Samsung SmartTV. Adobe Flash Authoring Tool : Adobe Creative Suite, Adobe Flash Professional, Flash Builder, and so on

@Samsung Electronics Copyright All Rights Reserved

SWF based Application Tutorial

2 Packaging an SWF based Application2.1 Structure of SWF based ApplicationIf an application developer specifies the application type as Adobe SWF based application in the configuration file, Samsung SmartTV loads an Adobe SWF file into Flash player on Samsung SmartTV. So, in order to package as Samsung SmartTV application with SWF file, developer should provide a proper configuration file (config.xml), thumbnail images, and authored SWF File. For the supported SWF version and detailed specification, please refer to the accompanied document, Flash Player Specification

[Pic. 1] Sample package of SWF based application Here is the brief description about each component in SWF based application package. - config.xml The config.xml file contains information about the applications execution, update, operating environment setting and other related issues. Developer should not change the name of config.xml. - SWF file Developer should locate Adobe SWF file inside application package. Developer can specify the path and name for SWF file that Flash Player loads. In the above example package, we use sample.swf. - Thumbnail images: Developer should locate the images for icons shown in Samsung SmartHub. In config.xml, you can specify the path for thumbnail images. In the above example package, we put thumbnail images in thumbnail folder. Developer does not need to include the FLA file for SWF. We include the FLA file for sample.swf for developers reference.

@Samsung Electronics Copyright All Rights Reserved

SWF based Application Tutorial

3 Creating a Simple SWF based Application3.1 Writing a config.xmlThe config.xml file contains the information about applications execution, update, operating environment setting and other related issues. Depending on that information, the application manager controls the version of your application, sets an environment in which your application is run, and creates and manages user accounts. The config.xml file should be located in the directory in which the application is installed. The following is an example of config.xml for SWF based application. SWFAppSample user y LifeStyle 1.0 12 ./thumbnail/icon_106.png ./thumbnail/icon_115.png ./thumbnail/icon_85.png ./thumbnail/icon_95.png ./sample.swf y SWF based Application 960 540 SWF based application should include the following tags in config.xml file. - 12 or 13 : It specifies the version of SWF file. Although Samsung Flash Player has compatibility to lower version of SWF, we recommend to use the following app type for the corresponding version of SWF. 12 : Flash Lite 3.1 13 : Flash 10.1 - : It specifies the path and name that SWF file is located The following table describes other tags for Samsung SmartTV application.

Element

DescriptionIndicates that the information is relevant to the application. An icon image displayed in the Application Manager. It is used in case of no focus and its size is 106 x 86pixel. An icon image displayed in the Application Manager. It is used in case that the focus is placed on an image and its size is 115 x 95 pixel. An icon image displayed in the Application Manager. The size is 85 x 70 pixel. An icon image displayed in the Application Manager. The size is 95 x 78 pixel. The category to distinguish applications, available items are video, sports, game, lifestyle, information, others. Decides whether to synchronize with hub site. The application which doesnt need synchronization chooses n.

ValueFile path

File path File path File path String y|n

@Samsung Electronics Copyright All Rights Reserved

SWF based Application Tutorial Shows information on contents type - 11: HTML + java-script + Flash Player Object - 12: Adobe SWF ( Ver. Flash Lite 3.1 ) - 13: Adobe SWF ( Ver. Flash 10.1 ) - 14 : Lua Script File path at the initial execution of contents Limited to non-HTML based applications - 12: Adobe SWF ( Ver. Flash Lite 3.1 ) - 13: Adobe SWF ( Ver. Flash 10.1 ) - 14 : Lua Script Channel Bound Service Type(optional) Confirms the relations with root-child clarifying root application ID. (Optional, Only when the channel bound service type is child.) When connected to more than one root, roots are distinguished by ::. Channel information to be executed channel bound service (Distinguish each channel using :: Ex::AAA::BBB::CCC) (Optional, only if channel bound service type is root.) It decides whether the installed channelbound service is displayed on the first main screen or not. (If you want to hide the service in the first main screen, select n.) Enter the application provider in this tag. The name of the JavaScript file that allows you to confirm account information of application providers. This file has to be written in a defined format. Decides a service is available to signin or not. If you select y, you can enter ID and password in Integrated Sign-in site of Application Manager for sign-in. Validity verification should be preceded in JavaScript file corresponding to tag value. Indicates the application version. Depending on that version information, the server computer updates the corresponding application. Indicates the Application Managers version that is required to run an application having the config.xml file. Indicates whether the application is a full-screen or a single-wide one. Display type affects the audio policy of the application when its run. Refer to Chapter. 6.4. Using Keys on Remote Control for details. If source conversion is needed, set this tag to y. If you select y, the TV source automatically switched from current TV channel or external input to the internal media player, and back again when the application is finished. Determines whether to use the childLock function. This function enables the user to lock an application. Turns on and off the audio. If you select y, TV broadcasting sound is not outputted when entering the application. Set y if the application occupies full screen and set n if the application occupies parts of the screen. Turns on and off the video. If you select y, TV broadcasting is not on the screen when entering the application. Sets the Disable dynamic contrast function. Dynamic contrast is the function to adjust TV contrast ratio and brighten TV screen by darkening the dark screen and lightening the light screen. The screen might get lighter or darker when application is on with Dynamic contrast. y turns off the Dynamic contrast, and N turns on the Dynamic contrast. If the application is occupied on full screen, select y to remove sparkling. If the application is partially occupied, select n. Application playing video files can bring problems as stated below. 1. If a video file is played in a device connected to HDMI port such

Number

File Path

root | child Application ID String

y|n String String

y|n

x.xxx x.xxx y|n

y|n

y|n

y|n

y|n

y|n

y|n

@Samsung Electronics Copyright All Rights Reserved

SWF based Application Tutorial as DVD Player when executing an application (ex. YouTube) converting sources, sounds can be mixed. 2. Sparkling at the entry for application due to the difference of Frame rate between the TV image and playing video file. If you select y, you can prevent it from the problem above by ending operating the connected HDMI device when executing the application and fixing the Frame rate. Enter a name of application. Enter a brief description of the application. Enter the screen area that the application will be occupying. Generally, it is recommended to enter 960 * 540 pixels, digital TV specification. Enter a description of the author. This tag is used when needed to check network while operating an application. If the tag value is y and the network test result is fail, entry for the application can be blocked with a message indicating the failure. Without any set value, default is y. This tag is used when needed to check whether the hub-site has been authorized or not while operating an application. If the tag value is y, and the hub-site has not been authorized, entry for the application can be blocked with a message indicating the failure. Without any set value, default is n. Indicates whether the application provides Push Notification Service. Without any set value, default is n. This tag is reserved for former Push Notification Service. Without any set value, default is n. Indicates whether Push Notification Service is provided for specific user. Without any set value, default is n. This tag should be enabled for application that use embedded flash player object, or stand-alone flash player.

String String Number string

y|n

y|n

y|n y|n y|n y|n

3.2 Sample SWF FileHere, simple SWF File is provided as example. This SWF file is exported as Flash Lite 3.1 in Adobe Flash Creative Suite. This SWF file gets the simple remote controller input and does simple animation. Flash Player on Samsung Smart TV supports the following remote controller key inputs. Power, Menu, Volume, and Channel related keys are handled by TV itself, not Flash Player.

Key4 Directional Keys ( Up / Down / Left / Right ) Enter Exit Color Key (Red/Blue/Green)

Behavior4 directional navigation (same as PC, mobile phone) OK (same as PC, mobile phone) Exiting application, and go to SmartHub or previous application Developer can use these color keys for their purpose

The following are the snap-shots of example SWF file.

@Samsung Electronics Copyright All Rights Reserved

SWF based Application Tutorial

[Pic. 2] First Scene of Example SWF File

[Pic. 3] Focus movement using left key in Example SWF File

@Samsung Electronics Copyright All Rights Reserved

SWF based Application Tutorial

[Pic. 4] Focus on Exit Key in Example SWF File

The following is the part of action-script code used in example swf file. Selection.setFocus("playBtn"); moving_circle.onEnterFrame = function() { if(Selection.getFocus() == "_level0.playBtn"){ if(Key.isDown(Key.ENTER)){ _root.moving_circle.play(); } }else if(Selection.getFocus() == "_level0.stopBtn"){ if(Key.isDown(Key.ENTER)){ _root.moving_circle.stop(); } }

@Samsung Electronics Copyright All Rights Reserved