Code: Select all
var loc = [0,1,2];
function soSomething(l){
$.write(l);
}
for(l = 0; l < loc.length; l++){
d.pnl.[l] = d.pnl.[c].add("panel", [0,(l*150),390,(l*150)+150]);
d.pnl.[l].text = loc[l];
d.pnl.[l].btn= d.pnl.[c].[l].add("button",[155,8,300,30], "some text");
d.pnl.[l].btn.onClick = function () {doSomething(l)} //<-- the problem..
}
So is there anyway around this? Because I've a whole lot of checkboxes, buttons, et cetera and I don't like to make a huge list of assigned functions to the elements.
Thanks in advance!