MovieClip interaction - help please

Sorry, this is probably very easy but:

How can I make it so that when one movieclip touches or goes near (preferable) another, it will advance to the next frame of the movieclip.

This is probably easier to explain if I say what I’m trying to do.

Spaceship flies around (mc) when it his an asteroid (another mc), the asteroid explodes

Thanks, Ben

http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=flash+mx+collision+hittest+tutorial

The best way is probably good ol’-fashioned hittest:


 // put this in the spaceship's code
 if (hitTest(_root.asteroid) == true) {
 	tellTarget (asteroid) {
 		  gotoAndPlay (first frame of explosion animation);
 	}
 }
 

The only thing to watch out for is to make sure you get the relative location of the objects right, i.e. _root.asteroid, or whatever. Hope this helps.

I tried this code and it said id needed an onClipEvent thing. I looked around the tutorials and forums and put one in but it still doesn’t work.

Could it be because I have other code attatched to the spaceship (to control it)?

Here is my .fla

Thanks
Ben

Hi,
I’ve made some little correction on the script and upload it again for you. You didn’t add quotes for the passing framelaber ie… gotoAndPlay (exploid);

Some other modificitons also made. check out
Try try until you reach that is the Mantra. :battery:

Thank you very much
Thanks and Thank you again

I could go on all day but I won’t because i need to look at this