I have this code.
for (i=1; i<6; i++) {
this.attachMovie("myMovie","unit"+i,i);
this["unit"+i]._x = i*100;
this["unit"+i].onRelease = function() {
trace("Unit number " + i + " was pressed");
};
}
I wan’t to trace the number (i) of the button that is pressed.
But no matter what button I press, I always get the value ‘6’ on my trace.
Isn’t there a way to store the a value for i in each movie clip attached?