I'm creating a number of buttons programmatically and I'd like to have
a unique value passed along to a function when each one is clicked.
So if I am doing something like:
for (i=0;i<10;i++) {
b = new Button();
b.y = offset;
b.label = "click me";
b.tooltip = "button "+i;
b.addEventListener(MouseEvent.CLICK, butSelect);
addChild(b);
offset+=20;
}
And I want to have, let's say, "i" passed along to the "butSelect"
function, how is that done? I humored myself and tried doing
butSelect(i) but of course the mouseEvent is passed and you're not
allowed to provide any parameters to the function.
Thanks!