

Like the first, the second method can cause the collision to happen too early, because even though the bounding boxes have overlapped, the shapes of the objects may not yet have met, so it won’t appear to the user that the two objects have collided. With the first, Flash doesn’t always detect a collision, even when the clips appear to overlap other times, especially in our case, the collision happens almost immediately, since the top of the ship is near the top of the stage. However, there are problems with all these methods. When set to false, it uses the shapes, which may be smaller than the bounding boxes, and which are closer to what the user sees on-screen. When set to true, it uses the bounding boxes. The third argument is shapeFlag, which tells Flash whether to use the clips’ bounding boxes or shapes to detect a collision. If you specify all three arguments, Flash uses the second or third method described above for detecting a collision. If you only specify one, Flash assumes it’s the name of the second movie clip.

By detecting an intersection of two specified movie clips using the syntax: firstMovieClip.hitTest(secondMovieClip).

It detects a collision between movie clips in one of three ways: The hitTest method is both powerful and flexible, handling all the sophisticated means of detecting a collision for you.
