Referencing movie clips in a for loop

I want to have 4 to n movie clips on my stage and to be be able perform monotonous operations on all of them in a for loop like so.

for(i=0;i<numClips;i++)
{
if(this.hitTest(“clip”+i))
trace(“hit!”);
else
trace(“no hit”);
}

as you can see I’ve labeled my clips clip1, clip2, clip3… but it won’t let me reference the clip using an expression “clip”+i

If i hard code it in like this…

if(this.hitTest(“clip1”))
trace(“hit!”);
else if(this.hitTest(“clip2”))
trace(“hit!”);
else
trace(“no hit”);

then it will work.

Any help would be greatly appreciated. thanks.

Welcome to kirupa forum, potamus. =)

Funny… I just posted this link in another thread. :stuck_out_tongue:
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082

problem solved!

No problem. :wink: