The Amazing Rotating Chicken
|
Version Flash 3
Difficulty Intermediate
|
|
|
|
Whoop, whoop, whoopee! Rotate that chicken, yeehaa...
Someone on Flashpad asked how to create smooth-scrolling text in Flash, so after some experimentation I came up with this. Here's the .fla file in zip form (Geocities won't let me upload raw .fla files, for some reason) for download.
If you're more interested in scrolling text than a rotating chicken (boring!), then just get rid of the chicken movie amd substitute an animation of text moving up the screen (see below for an example).
How it works
- The scene is just a collection of three objects, on separate layers - the rotating chicken (called Rotating Chicken, with the target name /chickrot) and the two buttons (called Clockwise button and Counterclockwise button)
- Rotating Chicken is just a movie, ten frames long, in which the chicken performs one full clockwise rotation. The first frame has a Stop action so that it doesn't play immediately when the scene loads.
- Each button, when clicked, uses Tell Target to make the chicken movie either step forward one frame or back one frame (using Go to Next Frame and Go to Previous Frame).
- However, to make the scrolling continuous (instead of having to click once for each frame back or forward) involves a bit of trickery, as follows:
- Create a new symbol (let's do the Clockwise button first). Place your button graphic in it.
- Edit the properties of the button graphic, and assign it the following actions:
On [Press, Drag Over, Drag Out]
Begin Tell Target
Go to Next Frame
End Tell Target
End On
[Tell Target should have the target /chickrot]
- Now create another keyframe in the current layer, so that there are two keyframes in total
- In frame 2, move the button so that it will be out of the viewing area when the movie is viewed.
- Create another layer exactly the same as the above but in this case, move the button out of view in frame 1.
- Repeat the above steps in a new movie for Counterclockwise Button, but this time instead of Go To Next Frame, use Go to Previous Frame.
- Drop the buttons into your movie and spin that chicken!
- What's going on? Basically, it's a trick to keep the movie playing while the button is held down. Normally it would stop after going forward (or back) one frame (like this), but by moving the button each frame and having the Drag Over, Drag Out conditions in the action, it keeps re-activating the button. Messy, but it works!
For those of you who don't follow the chicken analogy and just want to know how to do scrolling text, here's a version with boring scrolling text in it [and here's the .fla file in zip format].
I gleaned some of these techniques from the file 3ddirectioncontrol.fla at Open Source
Stickman
All files and text copyright ©Stickman 1998 - 2003. For copyright and terms of use information, please read this page.