1. Home
  2. Computing & Technology
  3. Animation

Ask the Magic 8-Ball: Using Flash to Create a Magic 8-Ball Application

By Adrien-Luc Sanders, About.com

9 of 9

Now all that’s left is to make it all come together; we’ve set up an animation to show the triangular display and added a function to display one of eight randomly generated messages, but it doesn’t do anything unless the timeline of the movie clip moves beyond frame 2. Right now it’s stuck on frame 1 because of that stop that we inserted, but that’s easily fixed.

Add a new symbol (movie clip or button) on the main stage; if you’d like you can also put in an input text box for people to type in their questions, but it’s not necessary for it to work; it’s purely cosmetic, so that it can seem as if they’re actually posing the question to the digital 8-ball rather than thinking it. All that really matters is the following script added to the button:

on (release) {
_root.ballanimated.gotoAndPlay(2) ;
}

This jumps the playhead of the movie clip ahead to frame two whenever the user determines that they’re ready to “shake up” the 8-ball and ask.

That just about covers it; depending on how you’ve set up your movie clips’ timelines and animations for fade-in and fade-out, you may need to throw in a few more stops here and there or another script on a new keyframe to once again empty the text of your dynamic text field.

Explore Animation
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

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

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Ask the Magic 8-Ball: Using Flash to Create a Magic 8-Ball Application

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

All rights reserved.