Collision detection is the most important concept in game development. It does not matter which programming language you are using for gaming. XNA, Flash or ... They all offer a method to detect collisions. You should be able to detect collisions and perform some logic to respond to it.
In this small tutorial I'm going to show you how to detect collisions in ActionScript. There are other ways to detect collisions in Flash / ActionScript but this one is the simplest one I believe.
Say you have a bullet movie clip and an enemy movie clip and need to know if the bullet hits the enemy. To do so follow these steps:
-
Open a new Flash file (anything but ActionScript 3.0 file).
-
Draw your bullet. For simplicity I used the Oval tool from the toolbox to create it.
-
Select the bullet object you just made and press F8 to convert it to a movie clip.
-
Select the movie clip and press Ctrl + F3 to open the Properties panel. Type bulletInstance in the instanceName box.
-
Draw the enemy. I used the Rectangle tool to create a simple rectangle as my enemy.
-
Select the rectangle and press F8 to convert it to a movie clip.
-
Select the enemy movie clip and press Ctrl + F3 to open the Properties panel. Then Type enemyInstance in the instanceName box.
-
-
Now we have all the graphics to start ActionScripting. Select the bulletInstance and press F9 to open the Actions panel. Type the following script:
-
-
We are done. Run our simple game by pressing Ctrl + Enter and confirm that the bullet stops after reaching (hitting) the enemy.

hitTest function:
I used hitTest method to detect collisions. I called this fucntion on the bulletInstance movie clip (I used this because I'm adding scripts to the bulletInstance's Action panel). It takes the target movie clip as a parameter (here enemyInstance) and examins for collisions between those two.