Here is the complete code
var httpLib = com.philips.HttpLibrary;
var actors;
for (var i = 0; i < MAX_LIGHTS; i++)
{
SetLineVisibility(i+1, false);
}
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 !