Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 3 made on Tuesday November 30, 2010 at 16:05
krissie
Lurking Member
Joined:
Posts:
November 2010
4
Here is the complete code
 
var httpLib = com.philips.HttpLibrary;
var actors;
 
for (var i = 0; i < MAX_LIGHTS; i++) 
{
  SetLineVisibility(i+1, false);
}
 
httpLib.getHTTP("[Link: 192.168.0.120], ParseData);
 
function SetLineVisibility(index, visible) 
{
  CF.widget("LBL_DESC_" + index).visible = visible;
  CF.widget("LBL_ICON_" + index).visible = visible;
  CF.widget("BTN_ON_" + index).visible = visible;
  CF.widget("BTN_OFF_" + index).visible = visible;
}
 
function ParseData(data) 
{
  var color;
  var i;
  function PowerOnUnit(unitid) {
    return function() {
      System.print("Power On " + unitid)
    };
  }
 
  
  actors = eval(data);
 
  for (i = 0; i < actors.length; i++) 
  {
    CF.widget("LBL_DESC_" + (i+1)).label = actors[i].description;
    actors[i].state > 0 ? color = 0x00ffff : color = 0xffffff;
    CF.widget("LBL_ICON_" + (i+1)).color = color;
    SetLineVisibility((i+1), true);
  
    CF.widget("BTN_ON_" + (i+1)).onPress = PowerOnUnit(actors[i].id);
  }
}


How would you write this code then ?

Thanks for replying !


Hosting Services by ipHouse