[FMX] duplicated MC's interaction

What is a simple method for getting duplicated movie clips to
interact?

I want two duplicated clips to do a hittest on each other. An
asteroid and a laser. I can use this. on one of the objects but how
do I pick up the name of the other object - it could be anything from
asteroid1 to asteroid100.

Thanks,
Tobias

you need to use loops and actually loop through each one of those 100 asteroids and check to see if there is a hitTest with each lazer beam to each asteroid.

If you have a lot of asteroids and a lot of lazers, this can get to be a very slow process. There are techniques to optimize this kind of interaction using clip layering and tile operations but your best bet is using the loop. If that proves to be too slow, you might want to try something else.

lazerBeam.onEnterFrame = function(){
for(var i=1; i <= 100; i++){
if (this.hitTest(_root[“asteroid”+i])) trace(“boom”);
}
etc.

That was what I was thinking - I am glad to see I am learning :slight_smile:

Thanks for your help.

Where in Maryland are you? I am in Gaithersburg in Montgomery County!

I work in Columbia but live in Westminster :slight_smile: