• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Using Conditional Logic > DETECTING COLLISIONS

DETECTING COLLISIONS

Many Flash applications, especially games, are able to detect object collisions—one of the most easily understood applications of conditional logic.

To detect collisions between two objects (movie clip instances), ActionScript provides the hitTest() method of the Movie Clip object. Using this method in conjunction with a conditional statement allows you to take action when two movie clips collide. You simply define in the script the various actions you want to take, depending on which object is hit. Take a look at the following script:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint