raskolnikov
08-21-2006, 06:33 AM
flashers,
basically, i have 20 buttons. i wanna set each button upon click to spit out a variable. i=1 for btn1, i=2 for btn2. etc...
here's a section of my code. though it doesn't work and when each button is click i=20 comes out coz the loop terminates at 20. so now i gotta script each indiviual button onRelese action out of the loop. how can i set the script in a for loop with multiple buttons all containing their individual variable?
for (i=1; i<20; i++) {
this["xlimit"+i] = (i-1)*gap;
//trace("sssssssssssssssss"+eval("xlimit"+i));
eval("timeline.but"+1).onRelease = function() {
this["timeline"].onEnterFrame = function() {
if (timeline._x<=eval("xlimit"+i)) {
delete timeline.onEnterFrame;
} else {
timeline._x -= speedBut;
}
};
};
}
basically, i have 20 buttons. i wanna set each button upon click to spit out a variable. i=1 for btn1, i=2 for btn2. etc...
here's a section of my code. though it doesn't work and when each button is click i=20 comes out coz the loop terminates at 20. so now i gotta script each indiviual button onRelese action out of the loop. how can i set the script in a for loop with multiple buttons all containing their individual variable?
for (i=1; i<20; i++) {
this["xlimit"+i] = (i-1)*gap;
//trace("sssssssssssssssss"+eval("xlimit"+i));
eval("timeline.but"+1).onRelease = function() {
this["timeline"].onEnterFrame = function() {
if (timeline._x<=eval("xlimit"+i)) {
delete timeline.onEnterFrame;
} else {
timeline._x -= speedBut;
}
};
};
}