|
|
Spin that chicken, round and round...spin chicky, spin!
I was very disappointed to note that Macromedia neglected to include a 'continuous feedback' button state in Flash 4, so I came up with my own new technique (here's the .fla file in .zip form). For some reason, people seemed to like the original rotating chicken (for Flash 3) so I thought I'd use it again...
It might look identical, but actually this new technique is much simpler to understand than the old one. It makes us of variables and if...endif statements to simplify the whole process, and it works well.
Put simply, you have the button set a variable to one value when it's clicked, then another when it's released (on or off, for example). Then you set up a movie clip loop to check continuously if that variable is in its 'on' state: if it is, it tells the animation to go forward or back, if it isn't it doesn't do anything.
Righto. As with the original technique, you start with a movie (in this case a chicken rotating, but it could just as easily be a scrolling menu or whatever). There is a Stop action in the first frame. It is placed in the timeline with the Instance name /chickrot.
Now we create our button (I used a stock button from Flash 3) and drop it into a new symbol -- a movie clip called cwbutton ('cw' for 'clockwise'). Now we have to give it some actions:
On (Press)
Set Variable: "forward" = "1"
End On
On (Release, Roll Out, Drag Out)
Set Variable: "forward" = "0"
End On
and click OK. New edit the first frame of our movie clip, and give it the following actions:
If (forward eq "1")
Begin Tell Target ("/chickrot")
Go to Next Frame
End Tell Target
End If
You need to add another keyframe to the movie clip, with an action telling it to Go To and Play frame 1 . Finally, you drop it in the scene alongside the rotating chicken movie.
So what's happening is that when you click on the button, it gives a variable -- forward -- the value "1" (it's "0" by default). When you let go of the mouse, it sets the value of forward back to "0". In the meantime, the movie clip is constantly checking if forward is set to the value "1" and if it is, it uses Tell Target to have /chickrot go forward by one frame.
It really is. Honest.
Good luck!
All files and text copyright ©Stickman 1998 - 2003. For copyright and terms of use information, please read this page.