Code snippets for LG KU990 Viewty themes & apps

updated: July 11, 2009

These code snippets are only compatible with the LG KU990 Viewty and related models, such as the KU990i and KU990GO.

Haptic feedback on button presses

This simple snippet makes the screen vibrate when called - generally used with the onPress action of buttons.

  1. platform.touch_sound();
Example usage
  1. my_btn.onPress = function() {
  2.     platform.touch_sound();
  3. }
  4. // makes the button with the instance name 'my_btn' vibrate when pressed on the phone.

Open the NYX menu or launch applications

Use the following function below with either a Dep or Id value (you can find these in LGAPP/Media/swf/en-UK.xml) to launch a menu page or application.

  1. function eventCall(dep:String, id:String) {
  2.     if (id == undefined || id == "") {
  3.         //No id - open menu Nyx page
  4.         platform.setMenuOn();
  5.         _root.idleQuick = true;
  6.         _root.QuickSet(dep);
  7.     } else {
  8.         //Open application
  9.         platform.launch_module(id);
  10.     }
  11. };
Example usage
  1.  
  2. eventCall("") // Open main NYX menu
  3. eventCall("", "0x27e00000"); // Open Inbox
  4. eventCall("3,1,1", ""); //Open browser submenu page

Displaying the 'Touch Ring' animation

Use the following two functions to show & hide the default style 'Touch Ring' animation.

To show the touch ring animation at a location xPos,yPos with a scaling factor scalePercent (100 is original size):

  1. show_pressAni(xPos:Number, yPos:Number, scalePercent:Number);

To hide the touch ring animation, simply call:

  1. out_pressAni();
Example usage
  1. my_btn.onPress = function() {
  2.     show_pressAni(120, 200, 50);
  3. }
  4.  
  5. my_btn.onReleaseOutside = function() {
  6.     out_pressAni();
  7. }
  8.  
  9. my_btn.onRelease = function() {
  10.     out_pressAni();
  11.     //Do something else
  12. }

This will show the touch ring animation at the center of the LG KU990 Viewty screen (120, 200) at half its original size when the button "my_btn" is pressed. It then hides the animation when the button is released.

Launching the Dialpad

If you want to open the Dialpad to let users call a number, simply use this little snippet.

  1. platform.launch_module("event:dialing");
Example usage
  1. my_btn.onRelease = function() {
  2.     platform.launch_module("event:dialing");
  3. }

Get SMS/Message counts

  1. function getMessages() {
  2.     _root.GetMessageCount(); //Call to Nyx - updates message counts
  3.     var inboxCount:Number = _root.inboxCount;
  4.     var newInboxCount:Number = _root.newInboxCount;
  5.     var draftCount:Number = _root.draftCount;
  6.     var sentCount:Number = _root.sentCount;
  7.     var outboxCount:Number = _root.outboxCount;
  8.     //Check to see if message counts have loaded yet
  9.     //it can take a few seconds at phone startup
  10.     if (isNaN(inboxCount)) {
  11.         inboxCount =  0;
  12.         newInboxCount = 0;
  13.         draftCount = 0;
  14.         sentCount = 0;
  15.         outboxCount = 0;
  16.     }
  17.    
  18.     //Now do what you like with the inboxCount, newInboxCount
  19.     //draftCount, sentCount and outboxCount variables
  20.     //You probably want to update you messages counts every
  21.     //5 seconds or so.
  22. }
Example usage
  1. getMessages();

Call this function everytime you want to update your message counters.

At the end of the function you would normally add a few statements to put the message counts into text-boxes, such as

  1.     //put this at the end of the getMessages function
  2.     my_text.text = newInboxCount + "/" + inboxCount

would update the 'my_text' text-box with the number of new messages and total messages in the users inbox.

You cannot get message counts for e-mails. Also it is not possible to retrieve the number of missed calls etc.

Get the current profile

To determine which profile the user currently has set, use the following snippet:

  1. function getProfile():Number {
  2.     //Update profile info
  3.     _root.GetProfileInfo();
  4.    
  5.     var profileNum:Number = _root.profileType;
  6.     if (isNaN(profileNum)) {
  7.         //Not a Number
  8.         profileNum = 1;
  9.     }
  10.    
  11.     return profileNum;
  12. }

profileNum is a number from 1 - 8.

Example usage
  1. var currentProfileNum:Number = getProfile();

Set the current profile

Unlike most menu options, the profiles do not have an associated 'dep' and 'id' (the ones listed in XML files do not do anything).

In order to set profiles, you'll need to use the following code:

  1. function setProfile(profileNum:Number) {
  2.     platform.setMenuOn();
  3.     platform.setDepth(2);
  4.     platform.setMenuNum();
  5.  
  6.     platform.setProfileNum(profileNum);
  7.     platform.activateCall();
  8.    
  9.     var iCount = 0;
  10.     timer_mc.onEnterFrame = function() {
  11.         iCount++;
  12.         if (iCount >= 3) {
  13.             _global.platform.setMenuReady();
  14.             _global.platform.setDepth(0);
  15.             _global.platform.setMenuNum();
  16.             _global.platform.setMenuReady();
  17.             delete this.onEnterFrame;
  18.         }
  19.     }
  20. }

You'll also need a MovieClip with the instance name 'timer_mc' in the same scene as the code, and it should span all the frames which contain interfaces that allow the user to change profiles.

profileNum is a number from 1 - 8: 1 = Normal, 2 = Silent, 3 = Vibrate, 4 = Outside, 5 = Headset, 6 & 7 & 8 = User defined profiles.

Example usage
  1. setProfile(1); //Sets the 'Normal' profile

Bear in mind that if the user has a headset plugged in, only the headset profile can be set, and if the user does not have the headset plugged in, the headset profile cannot be set.

Get the names of the user defined profiles

The names for most profiles are hard-coded in the language files, but for the user-defined ones you can detect their current names as follows:

  1. function getCustomProfileNames():Array {
  2.     platform.getUserdefineList();
  3.  
  4.     var userNameArr:Array = _root.userdefine_arr;
  5.     if (userNameArr[0] == undefined || userNameArr.length != 3) {
  6.         //Error - names may not be loaded yet
  7.         userNameArr = new Array("Custom 1", "Custom 2", "Custom 3");
  8.     }
  9.    
  10.     return userNameArr;
  11. }

The array returned by the function has 3 elements - the names of the three custom profiles.

Example usage
  1. var customArr:Array = getCustomProfileNames();
  2.  
  3. //Set profile names to text boxes
  4. //You'll need to create these text boxes in your theme
  5. //or use the array in your own way
  6. custom1_txt.text = customArr[0];
  7. custom2_txt.text = customArr[1];
  8. custom3_txt.text = customArr[2];

Detect whether the headset is plugged in

Use the following handy snippet to detect whether the user has their headset plugged in.

  1. function getHeadsetStatus():Boolean {
  2.     var headSta:Boolean = false;
  3.  
  4.     //Update profile info
  5.     _root.GetProfileInfo();
  6.  
  7.     var hSta = _root.headsetSta;
  8.     if (hSta == "on" || hSta == 1 || hSta == true) {
  9.         headSta = true;
  10.     }
  11.  
  12.     return headSta;
  13. }
Example usage
  1. var headsetOn:Boolean = getHeadsetStatus();
  2. if (headsetOn) {
  3.     //User has headset plugged in
  4. } else {
  5.     //No headset plugged in
  6. }

Gridlock theme

GridLock is a simple theme that combines the Lock Slider and Grid Menu. It also detects when the Nyx menu is opened, and hides the grid menu and lockscreen. Source code and sample swf included in the download (works on the mobile phone - but you must enter Dep and Id values in settings.txt for the items to function properly)

Loading and saving data using fscommand2

NOTE: All variables saved/loaded must be Numbers, and can be from -999999999 to 999999999. NOTE2: All methods with 'Recommended' next to them do not affect any saved user preferences.

How to read this list

For SET (Save) commands, the variable that you save is named 'saveVar'.
For GET (Load) commands, the saved data is loaded into a variabled named 'loadVar'.

  1. Command 1 (Do not use as conflicts with CYL, Recommended)
  2. -----------------------------------------------------------------
  3.     SET:
  4.     fscommand2("SetVars", "widget", "analogClockSkin", saveVar);
  5.  
  6.     GET:
  7.     fscommand2("GetVars", "widget", "analogClockSkin", "/");
  8.     loadVar = _root.analogClockSkin;
  9.  
  10. Command 2 (Recommended)
  11. -----------------------------------------------------------------
  12.     SET:
  13.     fscommand2("SetVars", "widget", "digitalClockSkin", saveVar);
  14.    
  15.     GET:
  16.     fscommand2("GetVars", "widget", "digitalClockSkin", "/");
  17.     loadVar = _root.digitalClockSkin;
  18.  
  19. Command 3 (Recommended)
  20. -----------------------------------------------------------------
  21.     SET:
  22.     fscommand2("SetVars", "widget", "dualClockSkin", saveVar);
  23.  
  24.     GET:
  25.     fscommand2("GetVars", "widget", "dualClockSkin", "/");
  26.     loadVar = _root.dualClockSkin;
  27.  
  28. Commands 4 & 5
  29. -----------------------------------------------------------------
  30.     SET:
  31.     var saveStr:String = "widget_x="+saveVar1+"&widget_y="+saveVar2;
  32.     platform.setWidgetData(saveStr);
  33.  
  34.     GET:
  35.     platform.getWidgetXY();
  36.     loadVar1 = _root.widget.widget_x;
  37.     loadVar2 = _root.widget.widget_y;    
  38.  
  39.  
  40. Commands 6 & 7
  41. -----------------------------------------------------------------
  42.     SET:
  43.     var saveStr:String = "calandar_x="+saveVar1+"&calandar_y="+saveVar2;
  44.     platform.setWidgetCalandarData(saveStr);
  45.  
  46.     GET:
  47.     platform.getWidgetCalandarXY();
  48.     loadVar1 = _root.widgetCalandar.calandar_x;
  49.     loadVar2 = _root.widgetCalandar.calandar_y;
  50.  
  51. Command 8
  52. -----------------------------------------------------------------
  53.     SET:
  54.     fscommand2("SetVars", "menu", "widgetNum", saveVar);
  55.  
  56.     GET:
  57.     platform.getWidgetNum();
  58.     loadVar = _root.widgetNum;
  59.  
  60. Command 9
  61. -----------------------------------------------------------------
  62.     SET:
  63.     fscommand2("SetVars", "widget", "calandarNum", saveVar);
  64.  
  65.     GET:
  66.     fscommand2("GetVars", "widget", "calandarNum", "/");
  67.     loadVar = _root.calandarNum;

comments (0)     Page views 2390     left side of starright side of starleft side of starright side of starleft side of starright side of starleft side of starright side of starleft side of starright side of star 

Services

WEB & FLASH DESIGN

  • Standards compliant CSS & XHTML web pages
  • Custom-built dynamic sites based on PHP/MySQL, e.g. blogs, CMS and more
  • Flash adverts, menu design and apps
  • PSD or PNG to XHTML/CSS
  • Flash Lite apps and games for mobile devices/cellphones including Nokia S60, Windows Mobile 6.1 and LG

 

Twitter updates

FOLLOW ME ON TWITTER

    "We can't solve problems by using the same kind of thinking we used when we created them." - Einstein on 31st Aug, 06:50:54

    Not buying another external WD drive although I do like the design. Recently had my third one fail. Glad I had other backups. Seagate? on 31st Aug, 06:41:00

    Looking for a new small yet powerful laptop/notebook. Narrowed it down to HP Envy 13 / HP Envy 14 / Asus U33Jc. Any advice? on 31st Aug, 06:21:37

    Must say the people at RGB co. / BirdGuides were all rather lovely. Shall hopefully be seeing some of them again soon. on 17th Aug, 14:05:11

    Finished watching Summer Heights High - rather funny I must say on 15th Aug, 14:20:43