Animation

  1. Home
  2. Computing & Technology
  3. Animation

Making Your Own Flash Slingshot Target Game: III

By Adrien-Luc Sanders, About.com

6 of 7

Flash needs to do a second thing when that collision test returns a value of true: it needs to go to the frame of the clip inside of squishie1 that begins the impact-reaction animation (breaking the loop set up that avoids it), and it needs to play from there. For this we’ll add a gotoAndPlay command:

onClipEvent (enterFrame) {
if (this.hitTest (_root.squishie1) ) {
_root.squishie1.stop ( ) ;
_root.squishie1.squishie1_1.gotoAndPlay (77) ;
}
}

Looks a little different from the gotoAndPlay that we’re used to, doesn’t it? It’s hierarchal, and the series of identifiers separated by periods tells Flash to start at the top and work its way downards. It’s basically a very simple road map, that tells Flash:

Go to the root/top level. When you get there, look for a movie clip instance named “squishie1”, and turn in there. Once you’re in there, look for another movie clip instance named “squishie1_1” and turn in there, too. Now drive all the way down squishie1_1’s timeline until you get to frame 77, park it there, and start to play.

Frame 77 on my timeline is where the bouncing ends and the impact-reaction animation begins; it may be different on yours.

Explore Animation

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Animation

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Making Your Own Flash Slingshot Target Game: III

©2009 About.com, a part of The New York Times Company.

All rights reserved.