Before using this lesson, you should be acquainted with the timeline, frames, keyframes, drawing shapes, modifying objects, symbols, and symbol instances.
Animations can be of two types: frame-by-frame, and tweened.
Frame-by-frame animations are similar to creating a flipbook animation, where the drawing on each page is incrementally different from the page that proceeds it. When you flip through the book rapidly, your drawing appears to move. Frame-by-frame animations are created the same way, except frames in the timeline take the place of pages in the flipbook. Frame-by-frame animations require little explanation, and usually, considerable drawing skill.
Tweened animations are more likely to be of use to instructional designers. A tweened animation is one in which you create a beginning state and an ending state for an object, and Flash determines the changes that need to be made to change from one to the other in the number of frames that you allow for the transition.
This lesson will cover the basics for motion and shape tweens. If you would like more detailed information, see Tweened animation.
The lesson will also discuss how to create buttons to control the playback of your animation. Try out the sample animation below.
Download the sample file: animation.zip (20 KB).
Motion tweens can be used for moving objects from point to point; for scaling objects up and down; for transitioning between different visual effects: alpha, tint, brightness.



Shape tweens can be used to "morph" shapes or to change colors of shapes directly.
Shape hints mark points on a shape to guide the tween. To use shape hints:


In the example ActionScript below, you will see lines marked with "//" and highlighted. These lines are comments, which explain the purpose of the preceding line of script.
stop();
play_btn.onRelease = function() {
// when the play button is clicked
play();
// play the main timeline
}
pause_btn.onRelease = function() {
// when the pause button is clicked
stop();
// stop the main timeline
}
stop_btn.onRelease = function() {
// when the stop button is clicked
gotoAndStop(1);
// move the playhead to frame 1 (back to the beginning of the animation) and stop
}
Skip back/forward controls are appropriate when your animation more than one section, as, for instance, in an animation with several steps.

step1_btn.onRelease = function() {
// when the button instance named "step1_btn" is clicked
gotoAndPlay("step1");
// move the playhead to the frame labeled "step1" and play the animation
}
stepplaying = 1;stepplaying = 2;
previous_btn.onRelease = function() {
// when the button instance named "previous_btn" is clicked
skipNum = stepplaying - 1;
// create a skip number variable that is one less than the current step
if (skipNum > 0) {
// if this skip number is larger than 0 (the current step is greater than 1),
skiptostep = "step" + skipNum;
gotoAndPlay(skiptostep);
// move the playhead to the previous step
}
}
next_btn.onRelease = function() {
// when the "next_btn" is clicked
skipNum = stepplaying + 1;
// create a skip number variable that is one greater than the current step
if (skipNum <= 3) {
// if this skip number is less than or equal to the total number of steps,
skiptostep = "step" + skipNum;
gotoAndPlay(skiptostep);
// move the playhead to the next step
}
}
Lesson index | Flash overview | Animation with playback controls | Interactive graphic | Importing external media in Flash | Common pitfalls in HTML and CSS | Embedding media objects in HTML