[RESOLVED] Loop brain fart
this is my loop. Basically I want to loop through every instance on the stage with the prefix of hotspot. I.E. - hotspot1, hotspot2, hotspot3, and so on.
Anyway, I do this, and get a reference error when i is greater than the amount of hotspot movieclips.
Code:
for (var i:uint = 1; this["hotspot"+i]; i++) {
trace(i);
this["hotspot"+i].alpha = 0;
trace(this["hotspot"+i].alpha);
}
then I try this:
Code:
for (var i:uint = 1; i<this["hotspot"+i]; i++) {
trace(i);
this["hotspot"+i].alpha = 0;
trace(this["hotspot"+i].alpha);
}
and nothing happens.
Then if I enter the total number of hotspot movieclips on stage it works, but I want it to count them, instead of me doing it. I.E. - this works:
Code:
for (var i:uint = 1; i<16; i++) {
trace(i);
this["hotspot"+i].alpha = 0;
trace(this["hotspot"+i].alpha);
}
Any ideas? Thanks