|
||||||||||||||
. . . . Elena Tresh Foundation Florida . |
Flash 8 Bouncing Ball AnimationThis flash 8 bouncing ball animation tutorial is a text version of the flash 8 video tutorial for bouncing ball. First of all create a movieclip(F8 - type is MovieClip, name is ball) called ball, giving it the instance name of ball_mc(Properties - instance name). Then work out how far you want the ball to drop. In this example the ball will drop to a _y property value of 280. So keep that in mind or write it down. Rename the layer that the ball is on to ball, create another layer and call it actions. Lock both these layers. Click on frame 1 of the actions layer and hit key F9 to open the actions window. We are going to import the Tween class and Easing class, so write this down in the actions window:-
import mx.transitions.Tween; import mx.transitions.easing.*;
Then you will need to create a new instance of the Tween class so that it does all the moving about. The Tween class constructor takes a number of parameters. They are like so" new Tween(ball_mc,"_y",Bounce.easeOut,ball_mc._y, 280,3,true); Now test the movie out to make sure it is working. (Control + Enter). It should bounce up and down a little bit and then stop.
If we want the ball to bounce and then go across the page, then create a new Tween that will move the _x value of the movieclip across the page. So add this code that will move the x property of the ball across the page with no easing to the _x value of 400 and with the same time as the y value tween. new Tween(ball_mc,"_x",None.easeNone,ball_mc._x, 400,3,true);
So test that out and it should bounce as well as move across the page. Change the x value to whatever you want. If you want it go off offscreen, change the ending x value to more than the width of your stage. So here is the complete code for this tutorial. Enjoy. import mx.transitions.Tween; import mx.transitions.easing.*; new Tween(ball_mc,"_y",Bounce.easeOut,ball_mc._y, 280,3,true); new Tween(ball_mc,"_x",None.easeNone,ball_mc._x, 400,3,true); Flash 8 Resources
Hollywood 2D Digital Animation: The New Flash Production Revolution |
|
||||||||||||
|
. | Home | Flash MX | Actionscript 2.0 | Flash 3D | Flash 8 | Flash Database | Flash Mobile | Flash CS3 | Java For Kids | Video Course | General Video | Photoshop | Web Design | Digital Photography | Games | free backgrounds | Resume | Streaming Video | Students Work | Links | Contact me | sitemap | reviews | . . |
||||||||||||||