lg flash open api reference guide

119
LG Flash Open API (FOA) Reference Guide Version 2.3 October 2011 LGDEV-015 Home Entertainment Company LG Electronics, Inc.

Upload: sergio-daniel-castaneda-nino

Post on 29-Nov-2014

339 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Lg Flash Open API Reference Guide

LG Flash Open API (FOA) Reference Guide

Version 2.3 – October 2011

LGDEV-015

Home Entertainment Company LG Electronics, Inc.

Page 2: Lg Flash Open API Reference Guide

Copyright

LG Flash Open API Reference Guide | 2

Copyright Copyright © 2010 LG Electronics, Inc. All Rights Reserved. Though every care has been taken to ensure the accuracy of this document, LG Electronics, Inc. cannot accept responsibility for any errors or omissions or for any loss occurred to any person, whether legal or natural, from acting, or refraining from action, as a result of the information contained herein. Information in this document is subject to change at any time without obligation to notify any person of such changes. LG Electronics, Inc. may have patents or patent pending applications, trademarks copyrights or other intellectual property rights covering subject matter in this document. The provision of this document does not give the recipient or reader any license to these patents, trademarks copyrights or other intellectual property rights. No part of this document may be communicated, distributed, reproduced or transmitted in any form or by any means, electronic or mechanical or otherwise, for any purpose, without the prior written permission of LG Electronics, Inc. This document is subject to revision without further notice. All brand names and product names mentioned in this document are trademarks or registered trademarks of their respective owners. TRADEMARKS Adobe, the Adobe logo, Flash, the Flash logo, and Flash Lite are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. All other trademarks and copyrights are the property of their respective owners.

Page 3: Lg Flash Open API Reference Guide

About This Document

LG Flash Open API Reference Guide | 3

About This Document

Revision History Document

Version Date Comment

2.3 October 7, 2011

Added a Note for the path of test application for LG Flash Open API. Deleted following functions: - Control.getEventInfoList - IO.setNetworkSettings - Application.getExecuteArgument Added following function: - getAppArgument

2.2 August 12, 2011 Added events for Media. Added events and functions for Magic Motion Remote Control.

2.1 May 13, 2011 Added 3D-related features and APIs.

2.0 April 28, 2011 Added LG Smart Text related function. Modified API source examples.

1.9 February 18, 2011 Modified API source examples.

1.8 January 11, 2011 Modified definition (overview) of Application, Control and IO.

1.7 December 24, 2010 Added Control and Media--related APIs.

1.6 November 22, 2010 Added Application-related APIs.

1.5 November 2, 2010 Added an API, PlayClipFile at chapter 2.4 Media.

1.4 October 29, 2010 Modified the add-on related functions

1.3 October 20, 2010 Modified the figure, Architecture of LG Flash Open API

1.2 July 16, 2010 Initial Version

Purpose This guide explains features, functions, and how-to-use information of the LG Flash Open API required to create the Flash content for LG DTV.

Reference Documents

Refer to the following documents:

- LG Smart TV SDK Installation Guide

- LG Flash Application Development Guide

Conventions

Codes

Source code and examples are indicated in the grey Courier New font.

Page 4: Lg Flash Open API Reference Guide

Abbreviations

LG Flash Open API Reference Guide | 4

Note, Caution

Note and caution are used to emphasize information. The following samples describe when each is used.

Note

Contains information about something that is helpful to you.

Caution

Contains important information about something that you should know.

Abbreviations The following table defines the abbreviations used in this document.

Abbreviation Description

API Application Programming Interface

ATC Advanced Television Systems Committee

DLNA Digital Living Network Alliance

DVB Digital Video Broadcasting

FOA Flash Open API

HOA Home Multimedia Open API

NTSC National Television Standards Committee

OSD On Screen Display

PAL Phaser Alternation Line

PSI Program and System Information

PSIP Program and System Information Protocol

SI Service Information

Page 5: Lg Flash Open API Reference Guide

Contents

LG Flash Open API Reference Guide | 5

Contents

1 Introduction ......................................................................................................... 8

1.1 Architecture of LG Flash Open API ................................................................................... 9

2 Application Programming Interface ................................................................ 10

2.1 General Data Structure.................................................................................................... 11

2.1.1 Type Definition .................................................................................. 11 AppType .......................................................................................... 12 AspectRatio ...................................................................................... 13 ChAttrib .......................................................................................... 14 ChMap ............................................................................................. 15 DisplayMode...................................................................................... 16 ExitCode .......................................................................................... 17 LocaleGroup ..................................................................................... 18 LocaleInfoType .................................................................................. 20 MediaChannel .................................................................................... 21 MediaCodecAudio ............................................................................... 22 MediaCodecImage............................................................................... 23 MediaCodecVideo ............................................................................... 24 MediaFormatType ............................................................................... 25 MediaPlayState .................................................................................. 26 MediaTransportType............................................................................ 27 MessageType ..................................................................................... 28 NetworkStatus ................................................................................... 30 NetworkType .................................................................................... 31 OSDType .......................................................................................... 32 PanelAttributeType ............................................................................. 33 PanelBacklightType............................................................................. 34 PanelResType .................................................................................... 35 PanelType ........................................................................................ 36 PopupType ....................................................................................... 37 RemoconType.................................................................................... 38 ReturnCode ...................................................................................... 39 SupportType ..................................................................................... 40 TVSourceType ................................................................................... 41 SmartMsg ......................................................................................... 42 Input3DMode ..................................................................................... 43

2.2 Application ....................................................................................................................... 44

2.2.1 Description ....................................................................................... 44

2.2.2 Function .......................................................................................... 44 releaseFocus ..................................................................................... 45 requestFocus..................................................................................... 46 setReady .......................................................................................... 47 getCommonPath ................................................................................ 48 back ............................................................................................... 49 exit ................................................................................................ 50 getAppArgument ................................................................................ 51

2.3 Control ............................................................................................................................. 52

2.3.1 Description ....................................................................................... 52

2.3.2 Function .......................................................................................... 52 setVolume ........................................................................................ 53 getVolume ........................................................................................ 54 setMute ........................................................................................... 55

Page 6: Lg Flash Open API Reference Guide

Contents

LG Flash Open API Reference Guide | 6

getMute ........................................................................................... 56 setAVBlock ....................................................................................... 57 getAVBlock ....................................................................................... 58 resetAVBlock..................................................................................... 59 setDisplayResolution ........................................................................... 60 getDisplayResolution ........................................................................... 61 setDisplayMode .................................................................................. 62 getDisplayMode ................................................................................. 63 setDisplayArea................................................................................... 64 getDisplayArea .................................................................................. 65 resetDisplayArea ................................................................................ 66 setAspectRatio .................................................................................. 67 getAspectRatio .................................................................................. 68 resetAspectRatio ................................................................................ 69 channelUp ........................................................................................ 70 channelDown .................................................................................... 71 setChannel ....................................................................................... 72 getChannel ....................................................................................... 73 getChannelList .................................................................................. 74 getLocaleInfo .................................................................................... 75 getCountry ....................................................................................... 76 getMenuLanguage ............................................................................... 77 getRegion ........................................................................................ 78 getCapability .................................................................................... 79 getSystemInfo ................................................................................... 80 getStorageSize .................................................................................. 81 getRemoconTypeInfo ........................................................................... 82 setMotionRemoteMode ......................................................................... 83 getDisplayPanelType ........................................................................... 84 setScreensaverOff .............................................................................. 85 setDimmingOff .................................................................................. 86 createPopup ..................................................................................... 87 activateSmartText .............................................................................. 88 set3DMode ....................................................................................... 89 get3DMode ....................................................................................... 90

2.4 Media .............................................................................................................................. 91

2.4.1 Description ....................................................................................... 91

2.4.2 Function .......................................................................................... 91 openChannel ..................................................................................... 92 closeChannel .................................................................................... 94 playClipFile ...................................................................................... 95 pauseClip ......................................................................................... 97 resumeClip ....................................................................................... 98 seekClip .......................................................................................... 99 stopClip .......................................................................................... 100 getPlayInfo ...................................................................................... 101 getSourceInfo ................................................................................... 103 getPlayClipFileBasePath ...................................................................... 105

2.4.3 Events ........................................................................................... 106

2.5 IO (Input/Output) ........................................................................................................... 109

2.5.1 Description ...................................................................................... 109

2.5.2 Function ......................................................................................... 109 getNetworkStatus .............................................................................. 110 getNetworkSettings ........................................................................... 111

3 Event Handling for Flash Application with Magic Motion Remote Control 113

Page 7: Lg Flash Open API Reference Guide

Figures

LG Flash Open API Reference Guide | 7

3.1 Events for Magic Motion Remote Control ...................................................................... 114

3.2 Functions for Magic Motion Remote Control .................................................................. 116

setMotionRemoteMode ........................................................................ 117 getRemoconTypeInfo .......................................................................... 118 createPopup .................................................................................... 119

Figures

[Figure 1] Architecture of LG Flash Open API ........................................................................... 9

Page 8: Lg Flash Open API Reference Guide

1 Introduction

This chapter provides an overview and architecture of LG Flash Open API. 1.1 Architecture of LG Flash Open API

Page 9: Lg Flash Open API Reference Guide

1 Introduction

LG Flash Open API Reference Guide | 9

1.1 Architecture of LG Flash Open API

LG Flash Open API consists of four components: Application, Control, Media, and IO. Following

describes the functionalities and roles of these components.

This shows the architecture of LG Flash Open API.

[Figure 1] Architecture of LG Flash Open API

Application

Provides the basic functions required to run a Flash application from start to end.

Control

Uses the functionalities of a legacy application in the system and is used to implement TV middleware.

This module provides APIs to support general TV functionalities including switching channels, adjusting

volume and importing program information. It also allows inserting an image to the background.

Media

Provides APIs to play and view audios, videos and images. This module supports both streaming and

downloaded media and offers related functionalities including playback, pause, resume, and stop. Also,

it supports the seek functionality for the downloaded media.

IO

Provides functions required to use the network, except the functions provided by the Linux system or

standard C library. This module receives the network connection status.

Page 10: Lg Flash Open API Reference Guide

2 Application Programming Interface

This chapter describes the data structure and APIs provided by LG Flash Open API. Each API is described in six categories: Description, Syntax, Parameter, Return Value, Remarks and Example. 2.1 General Data Structure

2.2 Application

2.3 Control

2.4 Media

2.5 IO

Note

LG provides a test application for LG Flash Open API. Developers can test APIs by using this application.

Location: [SDK Installation Path]\Flash_Project\FOA_Test.

Page 11: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 11

2.1 General Data Structure

2.1.1 Type Definition

Following defines a common type to be used throughout LG Flash Open API.

Page 12: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 12

AppType

This is application type for LG Flash Open API.

class lge.apis.AppType

{

public static var ALL: Number = 0;

public static var HOST: Number = (1<<1);

public static var ADDON: Number = (1<<2);

}

Member Value Description

ALL 0 All applications

HOST (1<<1) Host application

ADDON (1<<2) Add-on application

Page 13: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 13

AspectRatio

This is aspect ratio for LG Flash Open API.

class lge.apis.AspectRatio

{

public static var ARC16X9:Number = 0;

public static var JUSTSCAN:Number = 1;

public static var SET_BY_PROGRAM:Number = 2;

public static var ARC4X3:Number = 3;

public static var FULL:Number = 4;

public static var ZOOM:Number = 5;

}

Member Value Description

ARC16X9 0 - For 16X9 monitor : full screen - For 4X3 monitor : letter box

JUSTSCAN 1 Just Scan turns off cropping (re-blanking) and shows the complete video.

SET_BY_PROGRAM 2 The Set By Program displays the original aspect ratio. (e.g. 4X3 signal into a 4X3 display; 16X9 signal into a 16X9 display).

ARC4X3 3 - For 16X9 monitor : 4X3 with black bars on both sides (pillar box) - For 4X3 monitor : full screen

FULL 4 Always displays objects in full screen mode regardless of monitor and source types.

ZOOM 5 - For 16X9 monitor : zooms vertically - For 4X3 monitor : Ignored

Page 14: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 14

ChAttrib

This is channel attribute for LG Flash Open API.

class lge.apis.ChAttrib

{

public static var INCLUDE_BLOCK :Number = 0x00000100;

public static var EXCLUDE_BLOCK :Number = 0x00000200;

public static var INCLUDE_SKIPHIDDEN :Number = 0x00000400;

public static var EXCLUDE_SKIPHIDDEN :Number = 0x00000800;

public static var INCLUDE_SCRAMBLE :Number = 0x00004000;

public static var EXCLUDE_SCRAMBLE :Number = 0x00008000;

public static var INCLUDE_INVISIBLE :Number = 0x00010000;

public static var EXCLUDE_INVISIBLE :Number = 0x00020000;

public static var INCLUDE_INACTIVE :Number = 0x00040000;

public static var EXCLUDE_INACTIVE :Number = 0x00080000;

public static var TV_ONLY :Number = 0x01000000;

public static var RADIO_ONLY :Number = 0x02000000;

public static var MAIN_CH :Number = 0x10000000;

public static var SUB_CH :Number = 0x20000000;

public static var UNUSED_CH :Number = 0x40000000;

}

Member Value Description

INCLUDE_BLOCK 0x00000100 Includes the blocked channel property.

EXCLUDE_BLOCK 0x00000200 Excludes the blocked channel property.

INCLUDE_SKIPHIDDEN 0x00000400 Includes skipped and hidden channel properties.

EXCLUDE_SKIPHIDDEN 0x00000800 Excludes skipped and hidden channel properties.

INCLUDE_SCRAMBLE 0x00004000 Includes the scrambled channel property.

EXCLUDE_SCRAMBLE 0x00008000 Excludes the scrambled channel property.

INCLUDE_INVISIBLE 0x00010000 Includes the hidden channel property.

EXCLUDE_INVISIBLE 0x00020000 Excludes the hidden channel property.

INCLUDE_INACTIVE 0x00040000 Includes the inactive channel property.

EXCLUDE_INACTIVE 0x00080000 Excludes the inactive channel property.

TV_ONLY 0x01000000 TV property

RADIO_ONLY 0x02000000 Radio property

MAIN_CH 0x10000000 Main channel property

SUB_CH 0x20000000 Sub channel property

UNUSED_CH 0x40000000 Unused channel property

Page 15: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 15

ChMap

This is channel map for LG Flash Open API.

class lge.apis.ChMap

{

public static var CUSTOMIZED:Number = 1;

public static var FAVORITE :Number = 2;

public static var NONE :Number = 3;

}

Member Value Description

CUSTOMIZED 1 A channel detected by scanning

FAVORITE 2 A favorite channel

NONE 3 All channels

Page 16: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 16

DisplayMode

This is display mode for LG Flash Open API.

class lge.apis.DisplayMode

{

public static var NONE:Number = 0;

public static var UIWITHTV:Number = 1;

public static var FULLUI:Number = 2;

public static var FULLVIDEO:Number = 3;

public static var FULLIMAGE:Number = 4;

public static var FULLUIFAST:Number = 5;

public static var FULLUIKEEP:Number = 6;

public static var UIWITHTV_VCS:Number = 7;

public static var UIWITHTV_VCSAUDIO:Number = 8;

public static var FULLUI_VCSAUDIO:Number = 9;

public static var FULLVCSAV:Number = 10;

public static var RESERVED1:Number = 11;

public static var FULLUIWITHTV:Number = 12;

public static var FULLVIDEONVS:Number = 13;

public static var NUM:Number = 14;

}

Member Value Description

NONE 0 No UI exists.

UIWITHTV 1 UI elements overlap with the image on the TV screen.

FULLUI 2

UI elements are displayed in full screen mode covering the image on the TV screen. (UI transition is slow. However, it enables a quick start when playing a media file.)

FULLVIDEO 3 When playing a video in full screen mode.

FULLIMAGE 4 When playing an image in full screen mode.

FULLUIFAST 5

UI elements are displayed in full screen mode covering the image on the TV screen. (UI transition is fast. However, it prevents a quick start when playing a media file.)

FULLUIKEEP 6 Keeps existing UI and not performs Dimming On/Off. (Use at Netflix 2.1 trick/pause mode.)

UIWITHTV_VCS 7 VCS UI elements overlap with the image on the TV screen.

UIWITHTV_VCSAUDIO 8 VCS UI elements overlap with the image on the TV screen while VCS audio is active.

FULLUI_VCSAUDIO 9 UI elements are displayed in full screen mode while VCS audio is active and TV source is used as video.

FULLVCSAV 10 VCS Audio + Video

RESERVED1 11 RESERVED1.

FULLUIWITHTV 12 Entire screen shows UI and small TV screen.

FULLVIDEONVS 13 Entire screen shows video. (No Video Setting Menu)

NUM 14 Total number of these variables

Page 17: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 17

ExitCode

This is exit code for LG Flash Open API.

class lge.apis.ExitCode

{

public static var BAD_CRASH:Number = -1;

public static var NORMAL:Number = 0;

public static var BACK_TO_BROWSER:Number = 1;

public static var NEED_NETCONFIG:Number = 2;

public static var SW_UPDATE:Number = 3;

public static var BACK_TO_GAMEMENU = 4;

public static var RETURN = 5;

public static var EXEC_OTHERAPP = 6;

public static var BACK_TO_DASHBOARD = 7;

public static var BACK_TO_MYAPP = 8;

public static var BACK_TO_SEARCHRESULT = 9;

public static var NEED_NETCONFIG_NETCAST = 10;

public static var BACK_TO_NETWORKSETTING = 11;public static var BACK_TO_LAST

= 0xff;

}

Member Value Description

BAD_CRASH -1 When closed, restore to default TV state.

NORMAL 0 Basic close

BACK_TO_BROWSER 1 When closed, go back to Application Browser.

NEED_NETCONFIG 2 When closed, start Network Setting.

SW_UPDATE 3 When closed, start software update.

BACK_TO_GAMEMENU 4 When closed, go back to Game Menu.

RETURN 5 When closed, go back to the previous state.

EXEC_OTHERAPP 6 Run other application and close.

BACK_TO_DASHBOARD 7 When closed, go back to Smart board (Dash board.)

BACK_TO_MYAPP 8 When closed, go back to MyApp.

BACK_TO_SEARCHRESULT

9 When closed, go back to Search Result.

NEED_NETCONFIG_NETCAST

10 When closed, start Network Setting. (In case when the CP is entered into NetCast of Smart board (Dash board.)

BACK_TO_NETWORKSETTING

11 When closed, go back to network setting.

BACK_TO_LAST 0xff End of enumeration

Page 18: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 18

LocaleGroup

This is locale group for LG Flash Open API.

class lge.apis.LocaleGroup

{

public static var KR: Number = 1;

public static var US: Number = 2;

public static var BR: Number = 3;

public static var EU: Number = 4;

public static var CN: Number = 5;

public static var AU: Number = 6;

public static var SG: Number = 7;

public static var ZA: Number = 8;

public static var VN: Number = 9;

public static var TW: Number = 10;

public static var XA: Number = 11;

public static var XB: Number = 12;

public static var IL: Number = 13;

public static var ID: Number = 14;

public static var MY: Number = 15;

public static var IR: Number = 16;

public static var HK: Number = 17;

public static var ZZ: Number = 18;

}

Member Value Description

KR 1 Korea

US 2 United States

BR 3 Brazil

EU 4 EU

CN 5 China

AU 6 Australia

SG 7 Singapore

ZA 8 South Africa

VN 9 Vietnam

TW 10 Taiwan

XA 11 Latin America - countries using the analog broadcast standard. (NTSC)

XB 12 Central Asia and Asia/Oceania - countries using the analog broadcast standard. (PAL)

IL 13 Israel

ID 14 Indonesia

MY 15 Malaysia

IR 16 Iran

HK 17 China (Hong Kong)

Page 19: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 19

Member Value Description

ZZ 18 Not defined

Page 20: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 20

LocaleInfoType

This is locale information type for LG Flash Open API

class lge.apis.LocaleInfoType

{

public static var COUNTRY:Number = 0;

public static var LANGUAGE:Number = 1;

public static var GROUP:Number = 2;

}

Member Value Description

COUNTRY 0

Gets the country information from TV settings. The country code complies with the ISO-3166 Alpha-3 standard. It returns a string that represents the three-letter code (alpha-3) of ISO 3166-1. For example, ISO 3166-1 Code : KOR Country code to be returned : "KOR"

LANGUAGE 1

Gets the language information from TV settings. The language code complies with the ISO 639-2 standard. It returns a string that represents the three-letter code (alpha-3) of ISO 639. For example, ISO 639-2 Code : kor Language code to be returned : "kor"

GROUP 2 Gets the group information from TV settings and returns it in number. Group is defined as lge.apis.LocaleGroup.

Page 21: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 21

MediaChannel

This is media channel for LG Flash Open API.

Media channel type “C” is not used.

class lge.apis.MediaChannel

{

public static var A:Number = 0;

public static var B:Number = 1;

public static var RESERVED1:Number = 2;

public static var NUM:Number = 3;

}

Member Value Description

A 0 Channel A

B 1 Channel B

RESERVED1 2 RESERVED1

NUM 3 Maximum channel number

Page 22: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 22

MediaCodecAudio

This is media codec audio for LG Flash Open API.

class lge.apis.MediaCodecAudio

{

public static var MP3:Number = 0x01;

public static var AC3:Number = 0x02;

public static var MPEG:Number = 0x03;

public static var AAC:Number = 0x04;

public static var CDDA:Number = 0x05;

public static var PCM:Number = 0x06;

public static var LBR:Number = 0x07;

public static var WMA:Number = 0x08;

public static var DTS:Number = 0x09;

public static var AC3PLUS:Number = 0x0A;

public static var MASK:Number = 0x0F;

}

Member Value Description

MP3 0x01 MP3 codec

AC3 0x02 AC3 codec

MPEG 0x03 MPEG codec

AAC 0x04 AAC codec

CDDA 0x05 CDDA codec

PCM 0x06 PCM codec

LBR 0x07 LBR codec

WMA 0x08 WMA codec

DTS 0x09 DTS codec

AC3PLUS 0x0A AC3 plus codec

MASK 0x0F Gets the audio codec from Mixed property from Audio/Video codec.

Page 23: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 23

MediaCodecImage

This is media codec image for LG Flash Open API.

class lge.apis.MediaCodecImage

{

public static var JPEG:Number = (0x01<<8);

public static var PNG:Number = (0x02<<8);

public static var MASK:Number = (0x0F<<8);

}

Member Value Description

JPEG (0x01<<8) JPEG codec

PNG (0x02<<8) PNG codec

MASK (0x0F<<8) Image codec mask

Page 24: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 24

MediaCodecVideo

This is media codec video for LG Flash Open API.

class lge.apis.MediaCodecVideo

{

public static var MPEG1:Number = 0x10;

public static var MPEG2:Number = 0x20;

public static var MPEG4:Number = 0x30;

public static var MJPEG:Number = 0x40;

public static var H264:Number = 0x50;

public static var REALVIDEO:Number = 0x60;

public static var WMV:Number = 0x70;

public static var YUY2:Number = 0x80;

public static var VC1:Number = 0x90;

public static var DIVX:Number = 0xA0;

public static var MASK:Number = 0xF0;

}

Member Value Description

MPEG1 0x10 MPEG1 codec

MPEG2 0x20 MPEG2 codec

MPEG4 0x30 MPEG4 codec

MJPEG 0x40 MJPEG codec

H264 0x50 H.264 codec

REALVIDEO 0x60 Real video codec

WMV 0x70 WMV codec

YUY2 0x80 YUY2 (YUV422) format

VC1 0x90 VC1 codec

DIVX 0xA0 Divx codec

MASK 0xF0 Video codec mask

Page 25: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 25

MediaFormatType

This is media format type for LG Flash Open API.

class lge.apis.MediaFormatType

{

public static var RAW:Number = 0x00;

public static var WAV:Number = 0x01;

public static var MP3:Number = 0x02;

public static var AAC:Number = 0x03;

public static var AVI:Number = (0x01<<8);

public static var MP4:Number = (0x02<<8);

public static var MPEG1:Number = (0x03<<8);

public static var MPEG2:Number = (0x04<<8);

public static var ASF:Number = (0x05<<8);

public static var MKV:Number = (0x06<<8);

public static var JPG:Number = (0x08<<16);

public static var PNG:Number = (0x09<<16);

public static var CIF:Number = (0x0A<<16);

public static var AUDIO_MASK:Number = 0xFF;

public static var VIDEO_MASK:Number = (0xFF<<8);

public static var IMAGE_MASK:Number = (0xFF<<16);

}

Member Value Description

RAW 0x00 Raw data encoded in audio/video codec with no file format specified

WAV 0x01 WAVE file format (audio)

MP3 0x02 MP3 file format (audio)

AAC 0x03 AAC file format (audio)

AVI (0x01<<8) AVI file format (video)

MP4 (0x02<<8) MPEG4 file format (video)

MPEG1 (0x03<<8) MPEG1 file format (video)

MPEG2 (0x04<<8) MPEG2 file format (video)

ASF (0x05<<8) ASF file format (video)

MKV (0x06<<8) MKV file format (video)

JPG (0x08<<16) JPEG file format (image)

PNG (0x09<<16) PNG file format (image)

CIF (0x0A<<16) CIF file format (image)

AUDIO_MASK 0xFF Audio file format mask

VIDEO_MASK (0xFF<<8) Video file format mask

IMAGE_MASK (0xFF<<16) Image file format mask

Page 26: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 26

MediaPlayState

This is media play state for LG Flash Open API.

class lge.apis.MediaPlayState

{

public static var STOP:Number = 0;

public static var PLAY:Number = 1;

public static var PAUSE:Number = 2;

}

Member Value Description

STOP 0 Stop state

PLAY 1 Play state

PAUSE 2 Pause state

Page 27: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 27

MediaTransportType

This is media transport type for LG Flash Open API.

class lge.apis.MediaTransportType

{

public static var FILE:Number = 0x01;

public static var DLNA:Number = 0x02;

public static var RESERVED1:Number = 0x03;

public static var RESERVED2:Number = 0x04;

public static var RESERVED3:Number = 0x05;

public static var MSDL:Number = 0x06;

public static var RESERVED4:Number = 0x10;

public static varRESERVED5:Number = 0x11;

public static var RESERVED6:Number = 0x12;

}

Member Value Description

FILE 0x01 Selects when playing files.

DLNA 0x02 Selects when playing files with DLNA.

RESERVED1 0x03 RESERVED1

RESERVED2 0x04 RESERVED2

RESERVED3 0x05 RESERVED3

MSDL 0x06 Selects when playing files with MSDL.

RESERVED4 0x10 RESERVED4

RESERVED5 0x11 RESERVED5

RESERVED6 0x12 RESERVED6

Page 28: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 28

MessageType

This is message type for LG Flash Open API.

class lge.apis.MessageType

{

public static var MR_GESTURE_NORMAL:Number = 0;

public static var MR_GESTURE_SWING:Number = 1;

public static var MR_GESTURE_SWING_END:Number = 2;

public static var MR_GESTURE_SPACE_SENSING:Number = 3;

public static var MR_GESTURE_JUMP:Number = 4;

public static var MR_GESTURE_THROW:Number = 5;

public static var MR_GESTURE_FISHING:Number = 6;

public static var MR_GESTURE_END:Number = 7;

public static var MR_SETFEEDBACK:Number = 8;

public static var MR_REMOVECURSOR:Number = 9;

public static var MR_DISABLE_REMOVECURSOR:Number = 10;

public static var MR_MOTION_ON:Number = 11;

public static var MR_MOTION_OFF:Number = 12;

public static var MR_MOTION_POINT_MODE_HIDDEN:Number = 13;

public static var MR_MOTION_POINT_MODE_SELECT:Number = 14;

public static var MR_MOTION_POINT_MODE_BUSY:Number = 15;

public static var MR_MOTION_POINT_MODE_TEXT:Number = 16;

public static var MR_MOTION_POINT_MODE_DRAG:Number = 17;

public static var MR_MOTION_POINT_MODE_FORBIDDEN:Number = 18;

public static var MR_MOTION_POINT_MODE_PREV:Number = 19;

public static var END:Number = 0xff;

}

Member Value Description

MR_GESTURE_NORMAL 0 Magic Motion Remote Control is ready for the gesture message.

MR_GESTURE_SWING 1 Magic Motion Remote Control is ready for the swing message.

MR_GESTURE_SWING_END 2 Magic Motion Remote Control is ready to end the swing message.

MR_GESTURE_SPACE_SENSING

3 Magic Motion Remote Control is ready for the space sensing message.

MR_GESTURE_JUMP 4 Magic Motion Remote Control is ready for the jump message.

MR_GESTURE_THROW 5 Magic Motion Remote Control is ready for the throw message.

MR_GESTURE_FISHING 6 Magic Motion Remote Control is ready for the fishing message.

MR_GESTURE_END 7 Magic Motion Remote Control is ready to end the gesture recognition message.

MR_SETFEEDBACK 8 Feed back of Magic Motion Remote Control

MR_REMOVECURSOR 9 Magic Motion Remote Control removes E-Manual MR pointer.

MR_DISABLE_REMOVECURSOR

10 Disables the Magic Motion Remote Control’s function that removes E-Manual MR pointer.

MR_MOTION_ON 11 Disables the Magic Motion Remote Control’s event if its input is received.

MR_MOTION_OFF 12 Enables Magic Motion Remote Control.

MR_MOTION_POINT_MODE_HIDDEN

13 Magic Motion Remote Control is invisible.

MR_MOTION_POINT_MODE_SELECT

14 Arrow pointer of Magic Motion Remote Control

MR_MOTION_POINT_MODE_BUSY

15 Hourglass pointer of Magic Motion Remote Control

Page 29: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 29

Member Value Description

MR_MOTION_POINT_MODE_TEXT

16 I-beam pointer of Magic Motion Remote Control

MR_MOTION_POINT_MODE_DRAG

17 Hand pointer of Magic Motion Remote Control

MR_MOTION_POINT_MODE_FORBIDDEN

18 Slashed circle pointer of Magic Motion Remote Control

MR_MOTION_POINT_MODE_PREV

19 Previous style pointer of Magic Motion Remote Control

END 0xff End of enumeration

Page 30: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 30

NetworkStatus

This is network status for LG Flash Open API.

class lge.apis.NetworkStatus

{

public static var LINK_DISCONNECTED:Number = 0;

public static var LINK_CONNECTED:Number = 1;

public static var DISCONNECTED:Number = 2;

public static var CONNECTED:Number = 3;

public static var TRY_TO_CONNECT:Number = 4;

}

Member Value Description

LINK_DISCONNECTED 0 Ethernet cable is disconnected.

LINK_CONNECTED 1 Ethernet cable is connected.

DISCONNECTED 2 Ethernet cable is connected. A ping operation on the given address is failed.

CONNECTED 3 Ethernet cable is connected and the Internet is working. Or, a ping on the given address is successful.

TRY_TO_CONNECT 4 Trying to connect the network.

Page 31: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 31

NetworkType

This is network type for LG Flash Open API.

class lge.apis.NetworkType

{

public static var NONE:Number = 0;

public static var WIRED_ETHERNET:Number = 1;

public static var WIRELESS_WIFI:Number = (1<<1);

}

Member Value Description

NONE: 0 None

WIRED 1 Wired Network

WIRELESS_WIFI (1<<1) Wireless Network

Page 32: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 32

OSDType

This is OSD (On Screen Display) type for LG Flash Open API.

class lge.apis.OSDType

{

public static var NONE:Number = -1;

public static var MAIN:Number = 0;

public static var SUB:Number = 1;

public static var SUB_2:Number = 2;

public static var NUM:Number = 3;

}

Member Value Description

NONE -1 None

MAIN 0 Main OSD

SUB 1 Sub OSD

SUB_2 2 Sub-2 OSD

NUM 3 Total number of these variables

Page 33: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 33

PanelAttributeType

This is panel attribute type for LG Flash Open API.

class lge.apis.PanelAttributeType

{

public static var RESOLUTIONTYPE:Number = 0;

public static var DISPLAYTYPE:Number = 1;

public static var BACKLIGHTTYPE:Number = 2;

public static var FRCFRAMERATE:Number = 3;

public static var INCH:Number = 4;

public static var LAST:Number = 5;

}

Member Value Description

RESOLUTIONTYPE 0 Gets Resolution Type. (lge.apis.PanelResType)

DISPLAYTYPE 1 Gets Display Type. (lge.apis.PanelType)

BACKLIGHTTYPE 2 Gets Back Light Type. (lge.apis.PanelBacklightType)

FRCFRAMERATE 3 Sub-2 OSD

INCH 4 Gets FRC Frame Rate. (Number, Hz)

LAST 5 End of this enumeration

Page 34: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 34

PanelBacklightType

This is panel backlight type for LG Flash Open API.

class lge.apis.PanelBacklightType

{

public static var CCFL:Number = 0;

public static var NOR_LED:Number = 1;

public static var EDGE_LED:Number = 2;

public static var IOP_LED:Number = 3;

public static var LAST:Number = 4;

}

Member Value Description

CCFL 0 CCFL

NOR_LED 1 NOR LED

EDGE_LED 2 Edge LED

IOP_LED 3 IOP LED

LAST 4 End of enumeration

Page 35: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 35

PanelResType

This is panel resolution type for LG Flash Open API.

class lge.apis. PanelResType {

public static var RES_1920X1080P:Number = 0;

public static var RES_1920X1080I:Number = 1;

public static var RES_1376X776P:Number = 2;

public static var RES_1366X768P:Number = 3;

public static var RES_1365X768P:Number = 4;

public static var RES_1024X768P:Number = 5;

public static var RES_1024X720P:Number = 6;

public static var RES_1280X720P:Number = 7;

public static var RES_852X480P:Number = 8;

public static var RES_720X480P:Number = 9;

public static var NUMBER:Number = 10;

}

Member Value Description

RES_1920X1080P 0 1920x1080 Progressive

RES_1920X1080I 1 1920x1080 Interlaced

RES_1376X776P 2 1376x776 Progressive

RES_1366X768P 3 1366x768 Progressive

RES_1365X768P 4 1365x768 Progressive

RES_1024X768P 5 1024x768 Progressive

RES_1024X720P 6 1024x720 Progressive

RES_1280X720P 7 1280x720 Progressive

RES_852X480P 8 852x480 Progressive

RES_720X480P 9 720x480 Progressive

NUMBER 10 Total number of these variables

Page 36: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 36

PanelType

This is panel type for LG Flash Open API.

class lge.apis. PanelType {

public static var PLASMA:Number = 0;

public static var LCD:Number = 1;

public static var DLP_PROJECTION:Number = 2;

public static var LCD_PROJECTION:Number = 3;

public static var CRT:Number = 4;

public static var NUMBER:Number = 5;

}

Member Value Description

PLASMA 0 PDP

LCD 1 LCD

DLP_PROJECTION 2 DLP Projection

LCD_PROJECTION 3 LCD Projection

CRT 4 CRT

NUMBER 5 Total number of these variables

Page 37: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 37

PopupType

This is popup type for LG Flash Open API.

class lge.apis.PopupType

{

public static var RESERVED1:Number = 0;

public static var RESERVED2:Number = 1;

public static var RESERVED3:Number = 2;

public static var RESERVED4:Number = 3;

public static var RESERVED5:Number = 4;

public static var RESERVED6:Number = 5;

public static var 7RESERVED7:Number = 6;

public static var QUICKMENU:Number = 7;

public static var RESERVED8:Number = 8;

public static var RESERVED9:Number = 9;

public static var POPUP_3D:Number = 10;

public static var LAST:Number = 11;

}

Member Value Description

RESERVED1 0 Reserved 1

RESERVED2 1 Reserved 2

RESERVED3 2 Reserved 3

RESERVED4 3 Reserved 4

RESERVED5 4 Reserved 5

RESERVED6 5 Reserved 6

SRESERVED7 6 Reserved 7

QUICKMENU 7 Quick Menu (AV Setting menu)

RESERVED8 8 Reserved 8

RESERVED9 9 Reserved 9

POPUP_3D 10 3D Menu(3D Setting Menu)

LAST 11 End of this enumeration

Page 38: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 38

RemoconType

This is remote control type for LG Flash Open API.

class lge.apis.RemoconType

{

public static var MOTION:Number = 0;

public static var QUARTER_DIR:Number =1;

}

Member Value Description

MOTION 0 Magic Motion Remote Control

QUARTER_DIR 1 Common Remote Control

Page 39: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 39

ReturnCode

This is return type for LG Flash Open API.

class lge.apis.ReturnCode

{

public static var OK:Number = 0;

public static var HANDLED:Number = 0;

public static var ERROR:Number = -1;

public static var NOT_HANDLED:Number = -1;

public static var BLOCKED:Number = -2;

public static var INVALID_PARAMS:Number = -3;

public static var NOT_ENOUGH_MEMORY:Number = -4;

public static var TIMEOUT:Number = -5;

public static var NOT_SUPPORTED:Number = -6;

public static var BUFFER_FULL:Number = -7;

public static var HOST_NOT_CONNECTED:Number = -8;

public static var VERSION_MISMATCH:Number = -9;

public static var ALREADY_REGISTERED:Number = -10;

public static var LAST:Number = -11;

}

Member Value Description

OK 0 Successfully executed.

HANDLED 0 The given request is completely processed.

ERROR -1 An error occurred while processing the function.

NOT_HANDLED -1 The given request is not processed completely.

BLOCKED -2 Other application is using HOA exclusively; failed to execute the function.

INVALID_PARAMS -3 The function parameter has an invalid value.

NOT_ENOUGH_MEMORY -4 The memory is not enough to execute the function.

TIMEOUT -5 No response is received within the specified time since the execution request of the function.

NOT_SUPPORTED -6 The function is not supported due to the version incompatibility.

BUFFER_FULL -7 Failed to execute the function, because the buffer is filled up with data.

HOST_NOT_CONNECTED -8 Failed to execute the function, because the host is not connected.

VERSION_MISMATCH -9 Failed to execute the function because of the version incompatibility between the application and the library.

ALREADY_REGISTERED -10 The application is already registered into the manager.

LAST -11 End of enumeration

Page 40: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 40

SupportType

This is support type for LG Flash Open API.

class lge.apis.SupportType

{

public static var BLUETOOTH: Number = 0;

public static var PHOTOMUSIC: Number = 1;

public static var MOVIE: Number = 2;

public static var CIFS:Number = 3;

public static var DLNA:Number = 4;

public static var MOTIONREMOCON:Number = 5;

public static var DVRREADY:Number = 6;

public static var WIRELESSREADY:Number = 7;

public static var LOCALDIMMING:Number = 8;

public static var PICTUREWIZARD:Number = 9;

public static var ORANGE:Number = 10;

public static var NETCAST:Number = 11;

public static var CHANNELBROWSER:Number = 12;

public static var IPTV:Number = 13;

public static var SKYPE:Number = 14;

public static var SUPPORT_3D:Number = 15;

public static var LAST:Number = 16;

}

Member Value Description

BLUETOOTH 0 Support for Bluetooth

PHOTOMUSIC 1 Support for photos and music (in EMF)

MOVIE 2 Support for movies (EMF)

CIFS 3 Support for CIFS

DLNA 4 Support for DLNA

MOTIONREMOCON 5 Support for the Magic Motion Remote Control

DVRREADY 6 Support for DVR

WIRELESSREADY 7 Support for wireless connection

LOCALDIMMING 8 Support for local dimming

PICTUREWIZARD 9 Support for Picture Wizard

ORANGE 10 Support for Orange

NETCAST 11 Support for NetCast

CHANNELBROWSER 12 Support for Channel Browser

IPTV 13 Support for IPTV

SKYPE 14 Support for Skype

SUPPORT_3D 15 Support for 3D

LAST 16 End of enumeration

Page 41: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 41

TVSourceType

This is TV source type for LG Flash Open API.

class lge.apis.TVSourceType

{

public static var INPUT_ANTENNA_ANALOG :Number = 0x0001;

public static var INPUT_ANTENNA_DIGITAL :Number = 0x0002;

public static var INPUT_CABLE_ANALOG :Number = 0x0003;

public static var INPUT_CABLE_DIGITAL :Number = 0x0004;

public static var INPUT_CABLE_UNDEFINED :Number = 0x0005;

public static var INPUT_OCABLE_ANALOG :Number = 0x0006;

public static var INPUT_OCABLE_DIGITAL :Number = 0x0007;

public static var INPUT_1394_TV :Number = 0x0008;

public static var INPUT_CABLE_BOX :Number = 0x0009;

public static var INPUT_IP :Number = 0x000A;

public static var SYS_DVB :Number = 0x1000;

public static var SYS_ATSC :Number = 0x2000;

public static var UNDEFINED :Number = 0x0000;

}

Member Value Description

INPUT_ANTENNA_ANALOG

0x0001 Analog input transmitted through the antenna

INPUT_ANTENNA_DIGITAL

0x0002 Digital input transmitted through the antenna

INPUT_CABLE_ANALOG 0x0003 Analog input transmitted through the cable

INPUT_CABLE_DIGITAL 0x0004 Digital (QAM or VSB) input transmitted through the cable

INPUT_CABLE_UNDEFINED

0x0005 Undefined input transmitted through the cable

INPUT_OCABLE_ANALOG

0x0006 Analog input transmitted through the OpenCable

INPUT_OCABLE_DIGITAL

0x0007 Digital input transmitted through the OpenCable

INPUT_1394_TV 0x0008 1394 input

INPUT_CABLE_BOX 0x0009 Cable box input

INPUT_IP 0x000A IP input

SYS_DVB 0x1000 DVB System

SYS_ATSC 0x2000 ATSC System

UNDEFINED 0x0000 Undefined input

Page 42: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 42

SmartMsg

This is smart message type for LG Flash Open API.

class lge.apis.SmartMsg

{

public static var NOTI:Number = 0;

public static var SHOW:Number = 1;

public static var HIDE:Number = 2;

public static var LAST:Number = 3;

}

Member Value Description

NOTI 0 Send string and caret position to a smart phone

SHOW 1 Activate the virtual keyboard on a smart phone

HIDE 2 Deactivate the virtual keyboard on a smart phone

LAST 3 End of enumeration

Page 43: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 43

Input3DMode

This is 3D mode for LG Flash Open API.

class lge.apis.Input3DMode

{

public static var TOP_BOTTOM:Number = 0;

public static var SIDE_SIDE:Number = 1;

public static var CHECK_BOARD:Number = 2;

public static var FULL_HD:Number = 3;

public static var RESERVED1:Number = 4;

public static var RESERVED2:Number = 5;

public static var INPUT_2D_3D:Number = 6;

public static var LAST:Number = 7;

}

Member Value Description

TOP_BOTTOM 0 Top-Bottom mode

SIDE_SIDE 1 Side-by-Side mode

CHECK_BOARD 2 Check board mode

FULL_HD 3 Full HD mode

RESERVED1 4 RESERVED 1

RESERVED2 5 RESERVED 2

INPUT_2D_3D 6 Input-2D-3D mode

LAST 7 End of enumeration

Page 44: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 44

2.2 Application

2.2.1 Description

Definition

Application controls all instances and operations that occur when the system starts, runs and stops.

Features

Requests/cancels a focus

Requests a resource assignment; returns the assigned resource

Starts and stops other applications; gets the number of currently running applications

2.2.2 Function

Following is the functions of Application component.

Page 45: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 45

releaseFocus

Description

An application requests the release of focus.

Syntax

public function releaseFocus(exitCode:Number): Number;

Parameters

exitCode [in] The state when the application looses the focus (lge.apis.ExitCode)

Return Value

OK if a notification on releasing focus is successfully sent; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Application;

//object and variable declaration

var app:Application = new Application;

//function call

var retNum:Number= app.releaseFocus(exitCode);

Page 46: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 46

requestFocus

Description

An application requests the focus.

Syntax

public function requestFocus(): Number;

Parameters

None

Return Value

OK if the request is successfully sent; otherwise ERROR.

Remarks

Sometimes, the focus you requested is not delivered well. Check the message handler to confirm the focus status.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Application;

//object and variable declaration

var app:Application = new Application;

//function call

var retNum:Number= app.requestFocus();

Page 47: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 47

setReady

Description

This function informs manager that the application is ready to be executed.

Syntax

public function setReady():Number;

Parameters

None

Return Value

OK if informing manager is successfully executed; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Application;

//object and variable declaration

var app:Application = new Application;

//function call

var retNum:Number = app.setReady();

Page 48: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 48

getCommonPath

Description

This function gets the root path of common Flash Gadget.

Syntax

public function getCommonPath(): Object;

Parameters

None

Return Value

retObject.retCode:Number

OK if gadget path is successfully returned; otherwise ERROR. retObject.path:String

Gadget path

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Application;

//object and variable declaration

var app:Application = new Application;

//function call

var retObj:Object= app.getCommonPath();

Page 49: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 49

back

Description

This function goes back to the display that user wanted.

Syntax

public function back(): Number;

Parameters

None

Return Value

OK if the display goes back successfully; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Application;

//object and variable declaration

var app:Application = new Application;

//function call

var retNum:Number = app.back();

Page 50: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 50

exit

Description

This function exits the currently running application.

Syntax

public function exit(): Number;

Parameters

None

Return Value

OK if exit is successfully called, otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Application;

//object and variable declaration

var app:Application = new Application;

//function call

var retNum:Number = app.exit();

Page 51: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 51

getAppArgument

Description

This function returns appropriate value that matches the key in the argument string sent from the application which requested executing a Flash application.

Syntax

public function getAppArgument(key:String):String;

Parameters

key [in] The key name of the stored data

Return Value

keyValue:String Data that stores the value.

Remarks

When you execute App, some parameters are sent to TV. It consists of 4 parts and they are separated with a space. - The type of execution (--multi or --bg) - The path of the executable parameter - --args - The data to be read “-multi gostop.swf --args title=Go Stop&vender=LG? false”. This is an executable parameter sample. The sample consists of: --multi, gostop.swf, --args and title=GoStop&vender=LG. --multi, gostop.swf and --args are the required parts by App Manager. The last part 'title=GoStop&vender=LG' is tomporarily stored in the memory for the application to access during the execution. This part consists of one or more key=value formats by an ampersand (&).

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Application;

//object and variable declaration

var app:Application = new Application;

//function call

var title:String = app.getAppArgument(“title”);

Page 52: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 52

2.3 Control

2.3.1 Description

Definition

Control allows using the functionalities of a legacy application in the system. Currently, an API that

supports the TV features is available. It offers the API to support general TV features including host

software's exclusive information, channel switching, volume adjusting and program information loading.

There are other functions which must be called by the application when TV works as a host.

Features

Channel up/down

Volume setting

Audio/video block/unblock

Aspect ratio setting

Video display area setting

Importing a channel list, broadcast information list and schedule list

Current language, country and country group

Support for the TV features (e.g., Bluetooth, DLNA, and Magic Motion Remote Control)

Creating a popup message box

Magic Motion Remote Control-related features

UI display setting (On/off, display mode)

2.3.2 Function

Following is the functions of Control component.

Page 53: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 53

setVolume

Description

This function adjusts the TV volume. Both relative (+1, -1...) and absolute (0 - 100) values can be used to adjust the volume.

Syntax

public function setVolume(bShowVolumebar:Boolean, appType:Number,

bRelative:Boolean, volumeIn:Number): Number;

Parameters

bShowVolumebar [in] TRUE if the DTV UI volume bar is displayed for the changed volume; otherwise FALSE.

appType [in] Adjusts TV volume.

Value Description

lge.apis.AppType.HOST Adjusts the TV volume.

lge.apis.AppType.ADDON Adjusts the add-on application volume.

lge.apis.AppType.ALL Adjusts all volumes.

bRelative [in] TRUE if volumeIn is a relative value; FALSE if it is an absolute value.

volumeIn [in] Value to adjust the volume

TRUE if bRelative is a relative value; FALSE if it is an absolute value. The volume can be adjusted within the range of 0 - 100.

Return Value

OK if the volume is adjusted; otherwise ERROR.

Remarks

Before you use this API, check the Mute status with getMute. If Mute is on, turn it off to use this API.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.AppType;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number= control.setVolume(TRUE, AppType.HOST, FALSE, 50);

Page 54: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 54

getVolume

Description

This function gets the current TV volume.

Syntax

public function getVolume(appType:Number): Object;

Parameters

appType [in] lge.apis.AppType.

Value Description

AppType.HOST The TV volume

AppType.ADDON The add-on application volume

AppType.ALL All volumes

Return Value

retObject.retCode:Number

OK if the volume is adjusted; otherwise ERROR. retObject.volumeOut: Number

Gets the current volume (absolute value)

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.AppType;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getVolume(AppType.HOST);

Page 55: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 55

setMute

Description

This function mutes the TV volume.

Syntax

public function setMute(bShowVolumebar:Boolean, bMute:Boolean):

Number;

Parameters

bShowVolumebar [in] TRUE if the DTV UI volume bar is displayed for the changed mute status; otherwise FALSE.

bMute [in] Mutes the current volume if TRUE; changes back to the original

volume if FALSE.

Return Value

OK if the volume is muted; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.setMute(TRUE, TRUE);

Page 56: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 56

getMute

Description

This function gets the mute status of the TV.

Syntax

public function getMute(Void): Object;

Parameters

None

Return Value

retObject.retCode:Number

OK if the mute status is successfully obtained; otherwise ERROR. retObject.bMute: Boolean

Gets the mute status

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getMute();

Page 57: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 57

setAVBlock

Description

This function blocks the video and/or audio from playing on the TV or from the speaker.

Syntax

public function setAVBlock(bBlockAudio:Boolean, bBlockVideo:Boolean):

Number;

Parameters

bBlockAudio [in] TRUE to block the audio; otherwise FALSE.

bBlockVideo [in] TRUE to block the video; otherwise FALSE.

Return Value

OK if audio/video is successfully blocked; otherwise ERROR.

Remarks

Audio or video state that was already blocked in TV is not changed, even if an application enables it. It is still blocked based on the TV’s state.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.setAVBlock(TRUE, TRUE);

Page 58: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 58

getAVBlock

Description

This function gets whether or not the video is being displayed on the screen; or whether or not the audio is being generated from the speaker.

Syntax

public function getAVBlock(void):Object

Parameters

None

Return Value

retObject.retCode:Number

OK if the audio/video blocking status is successfully obtained; otherwise ERROR. retObject.bBlockAudio

TRUE if the audio is being blocked; otherwise FALSE. retObject.bBlockVideo

TRUE if the video is being blocked; otherwise FALSE.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getAVBlock();

Page 59: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 59

resetAVBlock

Description

This function resets the audio/video blocking. That is, it resets the audio/video blocking to the default setting used before the add-on application runs.

Syntax

public function resetAVBlock(Void): Number;

Parameters

None

Return Value

OK if it is reset successfully; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.resetAVBlock();

Page 60: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 60

setDisplayResolution

Description

This function sets the display resolution.

Syntax

public function setDisplayResolution(height:Number, width:Number,

osdType:Number):Number;

Parameters

height [in] Height

width [in] Width

osdType [in] OSD type (lge.apis.OSDType)

Return Value

OK if setting display resolution is successful; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.OSDType;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number=control.setDisplayResolution(100,200,OSDType.MAIN);

Page 61: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 61

getDisplayResolution

Description

This function gets the display resolution.

Syntax

public function getDisplayResolution(void):Object;

Parameters

None

Return Value

retObject.retCode:Number

OK if the display resolution is successfully obtained; otherwise ERROR. retObject.width: Number

The width of the display retObject.height: Number

The height of the display

Remarks

Note that the display resolution refers to the video plane resolution which is different to the UI plane resolution.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getDisplayResolution();

Page 62: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 62

setDisplayMode

Description

This function sets the display mode. Image quality is determined by the display mode.

Syntax

public function setDisplayMode(displayMode:Number): Number;

Parameters

displayMode [in] The way add-on application is displayed on the screen (lge.apis.DisplayMode)

Return Value

OK if the display mode is successfully changed; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.DisplayMode;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.setDisplayMode(DisplayMode.FULLUI);

Page 63: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 63

getDisplayMode

Description

This function gets the display mode.

Syntax

public function getDisplayMode(): Object

Parameters

None

Return Value

retObject.retCode:Number

OK if the display mode is successfully obtained; otherwise ERROR. retObject.displayMode:Number

Current Addon App on a screen (lge.apis.DisplayMode)

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.DisplayMode;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getDisplayMode();

Page 64: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 64

setDisplayArea

Description

This function sets the display area of the video. It uses the getDisplayResolution() function to get the resolution and sets the display area and size within the corresponding resolution.

Syntax

public function setDisplayArea(inX:Number, inY:Number,

inWidth:Number, inHeight:Number,dispX:Nubmer, dispY:Number,

dispWidth:Number, dispHeight:Number): Number;

Parameters

inX [in] The X coordinate of the area in which the input video is displayed

inY [in] The Y coordinate of the area in which the input video is displayed

inWidth [in] The width of the area in which the input video is displayed

inHeigh [in] The height of the area in which the input video is displayed

dispX [in] The X coordinate of the area to be displayed on the screen

dispY [in] The Y coordinate of the area to be displayed on the screen

dispWidth [in] The width of the area to be displayed on the screen

dispHeight [in] The height of the area to be displayed on the screen

Return Value

OK if the display area is set successfully; otherwise ERROR.

Remarks

Note that the display resolution refers to the video plane resolution which is different to the UI plane resolution. Set inX, inY, inWidth, and inHeight to "0" to set the whole input video area as a display area; set dispX, dispY, dispWidth, and dispHeight to "0" to display the video in full screen mode.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.setDisplayArea(50,50,80,100,0,0,200,200);

Page 65: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 65

getDisplayArea

Description

This function gets the area in which the video is displayed.

Syntax

public function getDisplayArea(Void): Object;

Parameters

None

Return Value

retObject.retCode:Number

OK if the display area is set successfully; otherwise ERROR. retObject.inX: Number

The X coordinate of the area in which the input video is displayed retObject.inY: Number

The Y coordinate of the area in which the input video is displayed retObject.inWidth: Number

The width of the area in which the input video is displayed retObject.inHeight: Number

The height of the area in which the input video is displayed retObject.dispX: Number

The X coordinate of the area to be displayed on the screen retObject.dispY: Number

The Y coordinate of the area to be displayed on the screen retObject.dispWidth: Number

The width of the area to be displayed on the screen retObject.dispHeight: Number

The height of the area to be displayed on the screen

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getDisplayArea();

Page 66: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 66

resetDisplayArea

Description

This function resets the display area. That is, it resets the display area to the default setting used before the add-on application runs.

Syntax

public function resetDisplayArea(Void): Number;

Parameters

None

Return Value

OK if it is reset successfully; otherwise ERROR.

Remarks

Note that the display area refers to the video plane and does not apply to the UI plane.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.resetDisplayArea();

Page 67: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 67

setAspectRatio

Description

This function sets the aspect ratio.

Syntax

public function setAspectRatio(ratio: Number): Number;

Parameters

ratio [in] The aspect ratio to apply (lge.apis.AspectRatio)

Return Value

OK if the aspect ratio is applied successfully; otherwise ERROR.

Remarks

Note that the aspect ratio applies only to the video plane, not to the UI plane.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.AspectRatio;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.setAspectRatio(AspectRatio.ARC16X9);

Page 68: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 68

getAspectRatio

Description

This function gets the current aspect ratio.

Syntax

public function resetAspectRatio(void): Number;

Parameters

None

Return Value

retObject.retCode:Number

OK if the aspect ratio is successfully obtained; otherwise ERROR. retObject.ratio:Number

The current aspect ratio (lge.apis.AspectRatio)

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getAspectRatio();

Page 69: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 69

resetAspectRatio

Description

This function resets the display area to the default setting used before the add-on application runs.

Syntax

public function resetAspectRatio(void): Number;

Parameters

None

Return Value

OK if it is reset successfully; otherwise ERROR.

Remarks

Note that the aspect ratio applies only to the video plane, not to the UI plane.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.resetAspectRatio();

Page 70: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 70

channelUp

Description

This function increases the current channel number one by one.

Syntax

public function channelUp(bShowBanner:Boolean): Number;

Parameters

bShowBanner [in] TRUE if the DTV UI banner is displayed for the changed

channel; otherwise FALSE.

Return Value

OK if the channel is changed; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.channelUp(TRUE);

Page 71: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 71

channelDown

Description

This function decreases the current channel number one by one.

Syntax

public function channelDown(bShowBanner:Boolean): Number;

Parameters

bShowBanner [in] TRUE if the DTV UI banner is displayed for the changed channel;

otherwise FALSE.

Return Value

OK if the channel is changed; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.channelDown(TRUE);

Page 72: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 72

setChannel

Description

This function changes the given channel number.

Syntax

public function setChannel(bShowBanner:Boolean,channel:Object):

Number;

Parameters

bShowBanner [in] TRUE if the DTV UI banner is displayed for the changed channel; otherwise FALSE.

channel [in] Channel object

Value Description

channel.SourceType:Number Broadcasting Source Type (lge.apis.TVSourceType)

channel.MajorNum:Number Major Number

channel.MinorNum:Number Minor Number (Not used in case of DVB)

channel.PhysicalNum:Number Physical Number

Return Value

OK if the channel is changed; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.TVSourceType;

//object and variable declaration

var control:Control = new Control;

//parameter

var chObj:Object = new Object();

chObj.SourceType = TVSourceType.INPUT_ANTENNA_DIGITAL;

chObj.MajorNum = 15;

chObj.MinorNum = 0;

chObj.PhysicalNum = 15;

//function call

var retNum:Number = control.setChannel(true,chObj);

Page 73: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 73

getChannel

Description

This function gets the current channel.

Syntax

public function getChannel();

Parameters

None

Return Value

retObject.retCode:Number

OK if the current channel is successfully obtained; otherwise ERROR. retObject.SourceType: Number

Broadcasting source type (lge.apis.TVSourceType) retObject.Name: String

Channel Name retObject.MajorNum:Number

Major Number retObject.MinorNum:Number

Minor Number (Not used in case of DVB) retObject.PhysicalNum:Number

Physical Number

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getChannel();

Page 74: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 74

getChannelList

Description

This function gets the channel list.

Syntax

public function getChannelList(attribute:Number):Object;

Parameters

None

Parameters

attribute [in] Gets the related attribute for the channel. It gets the Favorite List,

Audio channel or Video channel. lge.apis.ChMap and lge.apis.ChAttrib value can be used with an “OR” operation.

Return Value

retObject.retCode:Number

OK when channel list is successfully obtained; otherwise, ERROR. retObject.channelNum:Number

The number of Channels retObject.channelArr:Array

Channel array (amount of channelNum) retObject.channelArr[].SourceType:Number

Broadcasting Source Type (lge.apis.TVSourceType) retObject.channelArr[].Name:String

Channel Name retObject.channelArr[].MajorNum:Number

Major Number retObject.channelArr[].MinorNum:Number

Minor Number (Not used in case of DVB) retObject.channelArr[].PhysicalNum:Number

Physical Number

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.ChAttrib;

import lge.apis.ChMap;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control. getChannelList(ChMap.CUSTOMIZED|ChAttrib.TV_ONLY);

Page 75: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 75

getLocaleInfo

Description

This function gets the country, language and country group information from TV settings. The country code complies with the ISO 3166-1alpha-3 standard. It returns a string that represents the three-letter code (alpha-3) of ISO 3166-1. For example, ISO 3166-1 code : KOR Country code to be returned : "KOR" The language code complies with the ISO 639-2 standard. It returns a string that represents the three-letter code (alpha-3) of ISO 639. For example, ISO 639-2 Code : kor Language code to be returned : "kor" This function gets the group information from the TV settings and returns it in number. Group is defined as lge.apis.LocaleGroup.

Syntax

public function getLocaleInfo():Object

Parameters

None

Return Value

retObject.retCode:Number

OK if the locale information is successfully obtained; otherwise ERROR. retObject.country: String

The specified country retObject.language: String

The specified language retObject.group: Number The specified group (lge.apis.LocaleGroup)

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.LocaleInfoType;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getLocaleInfo();

Page 76: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 76

getCountry

Description

This function gets the country information from TV settings. The country code complies with the ISO 3166-1 alpha-3 standard. It returns a string that represents the three-letter code (alpha-3) of ISO 3166-1. For example, ISO 3166-1 code : KOR Country code to be returned : "KOR"

Syntax

public function getCountry():Object

Parameters

None

Return Value

retObject.retCode:Number

OK if the country information is successfully obtained; otherwise ERROR. retObject.country:String

The specified country

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getCountry();

Page 77: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 77

getMenuLanguage

Description

This function gets the language information from TV settings. The language code complies with the ISO 639-2 standard. It returns a string that represents the three-letter code (alpha-3) of ISO 639. For example, ISO 639-2 Code : kor Language code to be returned : "kor"

Syntax

public function getMenuLanguage():Object

Parameters

None

Return Value

retObject.retCode:Number

OK if the locale information is successfully obtained; otherwise ERROR. retObject.language: String

The specified language

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getMenuLanguage();

Page 78: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 78

getRegion

Description

This function gets the country group information from TV settings. This function gets the group information from TV settings and returns it in number. Group is defined as lge.apis.LocaleGroup.

Syntax

public function getRegion():Object

Parameters

None

Return Value

retObject.retCode:Number

OK if the locale information is successfully obtained; otherwise ERROR. retObject.group: Number

The specified group (lge.apis.LocaleGroup)

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.LocaleInfoType;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object= control.getRegion();

Page 79: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 79

getCapability

Description

This function gets the TV features. The features are Bluetooth, DLNA, Magic Motion Remote Control, Skype, etc.

Syntax

public function getCapability(supportType: Number):Object;

Parameters

supportType [in] Identifies the supported features. (class lge.apis.SupportType)

Return Value

retObject.retCode:Number

OK if the supported feature is identified; otherwise ERROR. retObject.bSupport:Boolean

TRUE if the feature is supported; otherwise FALSE or the supported type

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.SupportType;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getCapability(SupportType.BLUETOOTH);

Page 80: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 80

getSystemInfo

Description

This function gets the TV system information such as the model name and hardware/software versions.

Syntax

public function getSystemInfo(Void): Object;

Parameters

None

Return Value

retObject.retCode:Number

OK if the information is successfully obtained; otherwise ERROR. retObject.projectName:String

The project name retObject.modelName:String

The model name retObject.hwVer:String

The hardware version retObject.swVer:String

The software version retObject.ESN:String

ESN retObject.toolTypeName:String

The tool type name retObject.serialNumber:String

The serial number

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getSystemInfo();

Page 81: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 81

getStorageSize

Description

This function gets the storage size.

Syntax

public function getStorageSize(absPath:String):Object;

Parameters

absPath [in] Absolute path of storage that user want to get the size

Return Value

retObject.retCode:Number

OK if the storage size is successfully obtained; otherwise ERROR. retObject.availableStorageSize:Number

The storage available size retObject.totalStorageSize:Number

The storage total size

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//parameter

var absPath:String = “/mnt/test/bin”

//function call

var retObj:Object = control.getStorageSize(absPath);

Page 82: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 82

getRemoconTypeInfo

Description

This function gets the information of remote control type.

Syntax

public function getRemoconTypeInfo():Object;

Parameters

None

Return Value

retObject.retCode:Number

OK if the remote control type is successfully obtained; otherwise ERROR. retObject.remoconType:Number

Remote control type (lge.apis.RemoconType)

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.RemoconType;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object = control.getRemoconTypeInfo();

Page 83: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 83

setMotionRemoteMode

Description

This function sets the mode of Magic Motion Remote Control.

Syntax

public function setMotionRemoteMode(mode:Number):Number

Parameters

mode [in] Magic Motion Remote Control input mode (lge.apis.Messagetype)

Return Value

OK if the remote mode is successfully changed; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.Messagetype;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number =

control.setMotionRemoteMode(Messagetype.MR_REMOVECURSOR);

Page 84: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 84

getDisplayPanelType

Description

This function gets the panel type of the TV display.

Syntax

public function getDisplayPanelType(panelAttribType:Number): Object;

Parameters

panelAttribType [in] The attribute type of the display panel, which you want to know (lge.apis.PanelAttributeType)

Return Value

retObject.retCode:Number

OK if the display panel attribute is successfully obtained; otherwise ERROR. retObject.type: Number

The value varies depending on the display panel attribute and the attribute type. (see "lge.apis.PanelAttributeType")

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.PanelAttributeType;

//object and variable declaration

var control:Control = new Control;

//function call

var retObj:Object =

control.getDisplayPanelType(PanelAttributeType.DISPLAYTYPE);

Page 85: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 85

setScreensaverOff

Description

This function disables the screen saver or resets the value to the default setting.

Syntax

public function setScreensaverOff(bOff:Boolean): Number;

Parameters

bOff [in] TRUE to disable the screen saver; FALSE to reset the value to the default setting.

Return Value

OK if the screen saver is successfully enabled and disabled; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.setScreensaverOff(true);

Page 86: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 86

setDimmingOff

Description

This function disables the dimming feature or resets the value to the default setting.

Syntax

public function setDimmingOff(bOff:Boolean): Number;

Parameters

bOff [in] TRUE to disable the dimming feature; FALSE to reset to the value to default setting.

Return Value

OK if the dimming feature is successfully enabled or disabled; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.setDimmingOff(true);

var retNum:Number = control.switchToOSD(OSDType.MAIN);

Page 87: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 87

createPopup

Description

This function creates a TV native popup.

Syntax

public function createPopup(popupOption: Object)Object;

Parameters

popupOption [in] An option required to create a popup

Value Description

popupOption.type:Number Popuptype.(HOA_POPUP_TYPE_T-lge.apis.PopupType)

Return Value

retObject.retCode:Number

OK if the popup is successfully created; otherwise ERROR. retObject.popupHandle:Number

The handle of the created popup

Remarks

If the popup type is QUICKMENU or POPUP_3D, DisplayMode must be FULLVIDEO.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.DisplayMode;

import lge.apis.PopupType;

//object and variable declaration

var control:Control = new Control;

var popupOption:Object;

popupOption.type = PopupType.QUICKMENU;

//function call

var retNum:Number = con.setDisplayMode(DisplayMode.FULLVIDEO);

if(retNum== ReturnCode.OK)

{ var retObj:Object = control.createPopup(popupOption); }

Page 88: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 88

activateSmartText

Description

Activates the virtual keyboard on a smart phone or sends the string to the smart phone. (See "FFC2.0 Development Guide" for more details.)

Syntax

public function activateSmartText(showSelect:Number,

positionX:Number, positionY:Number, textString:String):Number;

Parameters

showSelect [in] Start Text String’s show/hide/none enum (lge.apis.SmartMsg)

positionX [in] Smart Text position x

positionY [in] Smart Text position y

textString [in] Smart Text string

Return Value

HOA_OK on success; Otherwise, ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Control;

import lge.apis.SmartMsg;

//object and variable declaration

var control:Control = new Control;

//function call

var retNum:Number = control.activateSmartText(SmartMsg.NOTI, 0, 0,

"test");

Page 89: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 89

set3DMode

Description

This function sets 3D mode with the assigned value.

Syntax

public function set3DMode(input3DMode:Number,

bRLBalance:Boolean):Number;

Parameters

input3DMode [in] Input 3D mode. (lge.apis.Input3DMode)

bRLBalance [in] LR: FALSE, RL : TRUE.

Return Value

OK if the 3D mode is successfully set; Otherwise ERROR.

Remarks

- 3D video is displayed only when DisplayMode is FULLVIDEO. - While video is on play, status change to 3D mode is unavailable.

Example

//required class import

import lge.apis.Control;

import lge.apis.Input3DMode;

//object and variable declaration

var control:Control = new Control();

//function call

var retNum:Number= control.set3DMode(Input3DMode.TOP_BOTTOM, true);

Page 90: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 90

get3DMode

Description

This function gets the 3D mode value that is set at current TV.

Syntax

public function get3DMode():Object;

Parameters

None

Return Value

retObject.retCode:Number ReturnCode.OK when 3D mode information is successfully received; Otherwise, ERROR. retObject.current3DMode:Number

3D mode (lge.apis.Input3DMode) retObject.bRLBalance:Boolean

RL:true, LR:false

Remarks

None

Example

//required class import

import lge.apis.Control;

import lge.apis.Input3DMode;

//object and variable declaration

var control:Control = new Control();

//function call

var retObj:Object= control.get3DMode();

var current3DMode:Number = retObj.current3DMode;

var bRLBalance:Boolean = retObj.bRLBalance;

Page 91: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 91

2.4 Media

2.4.1 Description

Definition

Media provides APIs to play and view audios, videos, and images. This module supports both streaming

and downloaded media and offers related functionalities including playback, pause, resume, and stop.

Also, it supports the seek functionality for the downloaded media.

Features

Audio clip playback

Audio streaming playback

Video clip playback

Video streaming playback

Image clip decoding

2.4.2 Function

Following is the functions of Media component.

Page 92: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 92

openChannel

Description

This function starts a channel and prepares the channel to play with the given transfer type and, format type. .

Syntax

public function openChannel(ch:Number, mediaTransportType:Number,

mediaFormatType: Number): Number;

Parameters

ch [in] A channel number (lge.apis.MediaChannel)

mediaTransportType [in] Transport type of media file (lge.apis.MediaTransportType)

mediaFormatType [in] A media file format (lge.apis.MediaFormatType)

Return Value

OK if playback is ready; INVALID_PARAMS if the parameter is not valid; otherwise ERROR.

Remarks

– Transfer type to set for each type:

Play Type Media Transport Type

File FILE

Streaming(MMS or HTTP) MSDL

RTMP class uses NetConnection and NetStream, not a Flash Open API.

Example1 (MediaTransportType:FILE and MediaFormatType:MP4)

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Media;

import lge.apis.MediaChannel;

import lge.apis.MediaTransportType;

import lge.apis.MediaFormatType;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

var mediaTransportType:Number = MediaTransportType.FILE;

var mediaFormatType:Number = MediaFormatType.MP4;

//function call

var retNum:Number = media.openChannel(ch, mediaTransportType,

mediaFormatType);

Example2 (MediaTransportType: MSDL and MediaFormatType: ASF)

//required class import

import lge.apis.ReturnCode ;

Page 93: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 93

import lge.apis.Media;

import lge.apis.MediaChannel;

import lge.apis.MediaTransportType;

import lge.apis.MediaFormatType;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

var mediaTransportType:Number = MediaTransportType.MSDL;

var mediaFormatType:Number = MediaFormatType.ASF;

//function call

var retNum:Number = media.openChannel(ch, mediaTransportType,

mediaFormatType);

Page 94: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 94

closeChannel

Description

This function ends the channel.

Syntax

public function closeChannel(ch:Number): Number;

Parameters

ch [in] A channel number (lge.apis.MediaChannel)

Return Value

OK if the channel is successfully ended; INVALID_PARAMS if the parameter is not valid; otherwise ERROR.

Remarks

If it is not a stop state, this function returns ERROR. To close channel, call stopClip first. Or, play should be fully done to the end and then finalized.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Media;

import lge.apis.MediaChannel;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

//function call

var retNum:Number = media.closeChannel(ch);

Page 95: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 95

playClipFile

Description

This function plays the clip. When the mediaFormatType that you set when you open a channel is Video or Image, display position is playOption. (If it is NULL, full screen display is set.)

Syntax

public function playClipFile(ch:Number, filename:String,

repeatNumber:Number, playOption:Object): Number;

Parameters

ch [in] A channel number (lge.apis.MediaChannel)

filename [in] An address for File path, URL, etc

repeatNumber [in] Repeated play numbers. 0 = repeat endlessly (Only for Audio.)

playOption [in] Starting time, Cache use or not and Display position All properties are optional. Only the necessary property is added and delivered.

Value Description

playOption.x: Number X position

playOption.y: Number Y position

playOption.width: Number Width

playOption.height: Number Height

playOption.startPositionMs: Number

Time to start playing (Millisecond) (Not supported now.)

playOption.bCacheOff: Boolean TRUE if you do not use cache. (Not supported now.)

Return Value

OK if the clip is successfully played; otherwise ERROR.

Remarks

For more information on MediaTransportType setting for each file type, refer to the openChannel.

Example

//required class import

import lge.apis.Media;

import lge.apis.MediaChannel;

import lge.apis.ReturnCode;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

var filename:String = sample.mp3";

//function call

Page 96: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 96

var retNum:Number = media.playClipFile(ch, filename, 0, ””);

Page 97: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 97

pauseClip

Description

This function pauses the clip, which is being played.

Syntax

public function pauseClip(ch: Number): Number;

Parameters

ch [in] A channel number (lge.apis.MediaChannel)

Return Value

OK if the clip is successfully paused; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Media;

import lge.apis.MediaChannel;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

//function call

var retNum:Number = media.pauseClip(ch);

Page 98: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 98

resumeClip

Description

This function resumes the paused clip.

Syntax

public function resumeClip(ch: Number):Number;

Parameters

ch [in] A channel number (lge.apis.MediaChannel)

Return Value

OK if the clip is successfully resumed; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Media;

import lge.apis.MediaChannel;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

//function call

var retNum:Number = media.resumeClip(ch);

Page 99: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 99

seekClip

Description

This function seeks the clip; changes the starting point of the clip which is being played to another point.

Syntax

public function seekClip(ch: Number, playPositionMs: Number): Number;

Parameters

ch [in] A channel number (lge.apis.MediaChannel)

playPositionMs [in] A starting point to play (in milliseconds)

Return Value

OK if the clip is successfully sought; INVALID_PARAMS if the parameter is not valid; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Media;

import lge.apis.MediaChannel;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

//function call

var retNum:Number = media.seekClip(ch, 30);

Page 100: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 100

stopClip

Description

This function stops the clip, which is being played or paused.

Syntax

public function stopClip(ch: Number):Number;

Parameters

ch [in] A channel number (lge.apis.MediaChannel)

Return Value

OK if the clip is successfully stopped; otherwise ERROR.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Media;

import lge.apis.MediaChannel;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

//function call

var retNum:Number = media.stopClip(ch);

Page 101: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 101

getPlayInfo

Description

This function gets the media play information, such as playback state and playback time of the media. Playback state includes play, stop, and pause, and the playback time is returned in milliseconds.

Syntax

public function getPlayInfo(ch: Number):Object;

Parameters

ch [in] A channel number (lge.apis.MediaChannel)

Return Value

retObject.retCode:Number

OK if successful; INVALID_PARAMS if the parameter is not valid; otherwise ERROR. retObject.playState:Number

Media play state (lge.apis.MediaPlayState) retObject.elapsedMS:Number

Elapsed time in milliseconds retObject.durationMS:Number

Total duration in milliseconds retObject.bufBeginSec:Number

The beginning of the buffered stream This is only valid for: MediaTransportType.DLNA MediaTransportType.YOUTUBE MediaTransportType.YAHOO retObject.bufEndSec:Number

The end of the buffered stream This is only valid for: MediaTransportType.DLNA MediaTransportType.YOUTUBE MediaTransportType.YAHOO retObject.bufRemainSec:Number

The rest of the buffered stream This is only valid for: MediaTransportType.DLNA MediaTransportType.YOUTUBE MediaTransportType.YAHOO retObject.instantBps:Number

Current streaming speed This is only valid for: MediaTransportType.DLNA MediaTransportType.YOUTUBE MediaTransportType.YAHOO retObject.totalBps:Number

The total streaming speed This is only valid for: MediaTransportType.DLNA MediaTransportType.YOUTUBE MediaTransportType.YAHOO

Page 102: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 102

retObject.lastCBMsg:Number

The latest callback message

Remarks

This function is valid after a channel is opened. After a channel is opened, basic status is a stop status. For a stop status, other values except status are not valid.

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Media;

import lge.apis.MediaChannel;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

//function call

var retObj:Object = media.getPlayInfo(ch);

Page 103: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 103

getSourceInfo

Description

This function gets the media information, which is being played.

Syntax

public function getSourceInfo(ch:Number): Object;

Parameters

ch [in] A channel number (lge.apis.MediaChannel)

Return Value

retObject.retCode:Number

OK if audio/video is successfully blocked; INVALID_PARAMS if the parameter is not valid; otherwise ERROR. retObject.title: String

The source title retObject.date: Date

The date when the source was created retObject.dataSize:Number

The total length of the source retObject.format: Number

Media format (container type) of the source (lge.apis.MediaFormatType) retObject.codec: Number

Media codec of the source (lge.apis.MediaCodecAudio, The O-Ringed value for lge.apis.MediaCodecVideo and lge.apis.MediaCodecImage) retObject.width: Number

The width of the source (Not available for playing the audio only) retObject.height: Number

The height of the source (Not available for playing the audio only) retObject.durationMS: Number

Total duration in milliseconds retObject.targetBitrateBps: Number

Requires an average bitrate in bps (bits per second) retObject.bIsValidDuration:Boolean

Whether or not durationMS is valid (FALSE if no duration exists. For example, live.) retObject.bIsSeekable: Boolean

Whether seekClip is available (TRUE) or not retObject.bIsScannable: Boolean

Whether setPlaySpeed is available (TRUE) or not

Remarks

This function is only valid when it is not a stop state.

Example

//required class import

Page 104: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 104

import lge.apis.ReturnCode ;

import lge.apis.Media;

import lge.apis.MediaChannel;

//object and variable declaration

var media:Media = new Media;

var ch:Number = MediaChannel.A;

//function call

var retObj:Object = media.getSourceInfo(ch);

Page 105: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 105

getPlayClipFileBasePath

Description

This function gets the absolute path of current running file.

Syntax

public function getPlayClipFileBasePath():Object;

Parameters

None

Return Value

retObject.retCode:Number

OK if absolute path is successfully obtained; otherwise ERROR. retObject.basePath:String

bsolute path of current running file.

Remarks

None

Example

//required class import

import lge.apis.ReturnCode ;

import lge.apis.Media;

//object and variable declaration

var media:Media = new Media;

//function call

var retObj:Object = media.getPlayClipFileBasePath();

Page 106: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 106

2.4.3 Events

PLAYBACK_START

This event is delivered when Media play starts.

<Example>

import lge.apps.LGEvent;

import lge.apps.LGExtendedEventManager;

var kEvent:LGExtendedEventManager =

LGExtendedEventManager.getInstance();

kEvent.addEventReceiver(this);

function onExtendedEventReceived($evt:LGEvent):Void{

if($evt.id==LGEvent.PLAYBACK_START) {

/* do something */

}

}

PLAYBACK_END

This event is delivered when Media play ends.

<Example>

import lge.apps.LGEvent;import lge.apps.LGExtendedEventManager;

var _evtMngr:LGExtendedEventManager =

LGExtendedEventManager.getInstance();

_evtMngr.addEventReceiver(this);

function onExtendedEventReceived($evt:LGEvent):Void{

if($evt.id==LGEvent.PLAYBACK_END) {

/* do something */

}

}

Page 107: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 107

ERR_PLAYING

This event is delivered when an error occurs while Media is on play.

<Example>

import lge.apps.LGEvent;

import lge.apps.LGExtendedEventManager;

var _evtMngr:LGExtendedEventManager =

LGExtendedEventManager.getInstance();

_evtMngr.addEventReceiver(this);

function onExtendedEventReceived($evt:LGEvent):Void{

if($evt.id==LGEvent.ERR_PLAYING) {

/* do something */

}

}

ERR_BUFFERFULL

This event is delivered when a buffer is full while Media is on play.

<Example>

import lge.apps.LGEvent;

import lge.apps.LGExtendedEventManager;

var _evtMngr:LGExtendedEventManager =

LGExtendedEventManager.getInstance();

_evtMngr.addEventReceiver(this);

function onExtendedEventReceived($evt:LGEvent):Void{

if($evt.id==LGEvent.ERR_BUFFERFULL) {

/* do something */

}

}

Page 108: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 108

ERR_BUFFERLOW

This event is delivered when an input to the buffer is low while Media is on play.

<Example>

import lge.apps.LGEvent;

import lge.apps.LGExtendedEventManager;

var _evtMngr:LGExtendedEventManager =

LGExtendedEventManager.getInstance();

_evtMngr.addEventReceiver(this);

function onExtendedEventReceived($evt:LGEvent):Void{

if($evt.id==LGEvent.ERR_BUFFERLOW) {

/* do something */

}

}

SLOW_NETWORK

This event is delivered when Media play is processed with the speed of 500k bps over 1 minute.

<Example>

import lge.apps.LGEvent;

import lge.apps.LGExtendedEventManager;

var _evtMngr:LGExtendedEventManager =

LGExtendedEventManager.getInstance();

_evtMngr.addEventReceiver(this);

function onExtendedEventReceived($evt:LGEvent):Void{

if($evt.id==LGEvent.SLOW_NETWORK) {

/* do something */

}

}

Page 109: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 109

2.5 IO (Input/Output)

2.5.1 Description

Definition

IO provides functions required to use the network, except the functions provided by the Linux system or

standard C library. This module receives the network connection status.

2.5.2 Function

Following is the functions of IO component.

Page 110: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 110

getNetworkStatus

Description

This function gets the network status. This function tests the connection status of the link (only if ipAddress is not "" (NULL)) and the network and returns the status.

Syntax

public function getNetworkStatus(ipAddress:String): Object;

Parameters

ipAddress [in] An IP address to ping

Ping is not performed if "" (NULL.)

Return Value

retObject.retCode:Number

OK if the network status is successfully obtained; otherwise ERROR. retObject.activatedNetwork:Number

Currently enabled network type (lge.apis.NetworkType) retObject.status:Number

The network status (lge.apis.NetworkStatus)

Remarks

None

Example

import lge.apis.ReturnCode ;

import lge.apis.IO;

//object and variable declaration

var io:IO = new IO;

//function call

var retObj:Object = io.getNetworkStatus(ipAddress);

Page 111: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 111

getNetworkSettings

Description

This function gets the network settings.

Syntax

public function getNetworkSettings(networkType:Number): Object;

Parameters

networkType [in] A network type to get the setting (see "lge.apis.NetworkType")

Return Value

retObject.retCode:Number

If the network setting is successfully obtained; otherwise ERROR. retObject.ipAddress: String

An IP address in the "A.B.C.D" format retObject.subnetMask: String

The subnet mask in the "A.B.C.D" format retObject.gateway: String

The gateway in the "A.B.C.D" format retObject.DNSServer1: String

DNS server 1 in the "A.B.C.D" format retObject.DNSServer2: String

DNS server 2 in the "A.B.C.D" format retObject.macAddress: String

The MAC address in the "A:B:C:D:E:F" format retObject.DHCPServer: String

The DHCP server address in the "A.B.C.D" format retObject.bDHCP: Boolean

Whether the DHCP is enabled (1) or not (0) retObject.macAddressOfAP: String

The MAC address of the wireless AP in the "A:B:C:D:E:F" format

Remarks

None

Example

import lge.apis.ReturnCode ;

import lge.apis.IO;

import lge.apis.NetworkType;

//object and variable declaration

var io:IO = new IO;

var networkType:Number = NetworkType.WIRELESS_WIFI;

//function call

Page 112: Lg Flash Open API Reference Guide

2 Application Programming Interface

LG Flash Open API Reference Guide | 112

var retObj:Object = io.getNetworkSettings(networkType);

Page 113: Lg Flash Open API Reference Guide

3 Event Handling for Flash Application with Magic Motion Remote Control

This chapter describes the events and functions for Flash application when users use Magic Motion Remote Control. 3.1 Events for Magic Motion Remote Control 3.2 Functions for Magic Motion Remote Control

Page 114: Lg Flash Open API Reference Guide

3 Event Handling for Flash Application with Magic Motion Remote Control

LG Flash Open API Reference Guide | 114

3.1 Events for Magic Motion Remote Control

Following describes event handling for Flash application when users use Magic Motion Remote Control

provided by LG TV.

Events in Movieclip Class

Event Description

onDragOut = function() {} Invoked when the mouse button is pressed and the pointer rolls outside the object.

onDragOver = function() {} Invoked when the pointer is dragged outside and then over the movie clip.

onMouseDown = function() {} Invoked when the mouse button is pressed.

onMouseMove = function() {} Invoked when the mouse moves.

onMouseUp = function() {} Invoked when the mouse button is released.

onPress = function() {} Invoked when a user clicks the mouse while the pointer is over a movie clip.

onRelease = function() {} Invoked when a user releases the mouse button over a movie clip.

onReleaseOutside = function() {} Invoked after a user presses the mouse button inside the movie clip area and then releases it outside the movie clip area.

onRollOut = function() {} Invoked when a user moves the pointer outside the movie clip area.

onRollOver = function() {} Invoked when user moves the pointer over a movie clip area.

Events in Mouse Class

Event Description

onMouseDown = function() {} Notified when the mouse is pressed.

onMouseMove = function() {} Notified when the mouse moves.

onMouseUp = function() {} Notified when the mouse is released.

Page 115: Lg Flash Open API Reference Guide

3 Event Handling for Flash Application with Magic Motion Remote Control

LG Flash Open API Reference Guide | 115

Events for Magic Motion Remote Control

Event Description

EVT_MOTIONREMOCON_ON Invoked when the input occurs from Magic Motion Remote Control

EVT_MOTIONREMOCON_OFF Invoked when the input occurs from Common (Basic) Remote Control (RCU.)

EVT_MOTIONREMOCON_CH_UP Invoked when the [channel up] key on Magic Motion Remote Control is pressed.

EVT_MOTIONREMOCON_CH_DOWN Invoked when the [channel down] key on Magic Motion Remote Control is pressed.

Following is the examples.

<Adding listener>

// Registers an object to receive notifications of the LGAPPEvent

listener.

_global.ExtendedEvents.LGAPPEvent.addListener(this);

function onEvent(event:String):Void {

if(event == "EVT_MOTIONREMOCON_ON"){

doSomethingForMouseOn();

}else if(event == "EVT_MOTIONREMOCON_OFF"){

doSomethingForMouseOff();

}else if(event == “EVT_MOTIONREMOCON_CH_UP”){

doSomethingForChUp();

} else if(event == “EVT_MOTIONREMOCON_CH_DOWN”){

doSomethingForChDown();

}

}

// Receives events by string type

<Removing listener>

// Removes the registered object, which was related to LGAPPEvent.

_global.ExtendedEvents.LGAPPEvent.removeListener(this);

Page 116: Lg Flash Open API Reference Guide

3 Event Handling for Flash Application with Magic Motion Remote Control

LG Flash Open API Reference Guide | 116

3.2 Functions for Magic Motion Remote Control

Page 117: Lg Flash Open API Reference Guide

3 Event Handling for Flash Application with Magic Motion Remote Control

LG Flash Open API Reference Guide | 117

setMotionRemoteMode

Description

This function hides the cursor.

Syntax

function setMotionRemoteMode(mode:Number):Number

Parameters

Mode: 9 - REMOVECURSOR

10- DISABLE_REMOVECURSOR

Return Value

None.

Remarks

None

Example

Import lge.apis.Application;

Var app:Application = new Application();

// hide cursor

app. setMotionRemoteMode(9);

//disable hide cursor event

app. setMotionRemoteMode(10);

Page 118: Lg Flash Open API Reference Guide

3 Event Handling for Flash Application with Magic Motion Remote Control

LG Flash Open API Reference Guide | 118

getRemoconTypeInfo

Description

This function gets the remote control type information.

Syntax

public function getRemoconTypeInfo():Object;

Parameters

None

Return Value

retObject.retCode:Number

- On success, ReturnCode.OK, otherwise errors. retObject.remoconType:Number

- 0: Magic Motion Remote Control - 1: Common Remote Control

Remarks

None

Example

Import lge.apis.Application;

var kApp:Application = new Application();

var kObj:Object = kApp.getRemoconTypeInfo();

if(kObj.remoconType)

trace(“this is Basic RCU”);

else

trace(“this is pointing RCU”);

Page 119: Lg Flash Open API Reference Guide

3 Event Handling for Flash Application with Magic Motion Remote Control

LG Flash Open API Reference Guide | 119

createPopup

Description

This function creates popup.

Syntax

function createPopup(popupOption:Object):Object

Parameters

popupOption.type = 7

(It does not care other parameter’s attributes.)

Return Value

None

Remarks

None

Example

Import lge.apis.Control;

var kCon:Control = new Control();

var kObj:Object = new Object();

kObj.type = 7;

kCon.createPopup(kObj);