3.7. Changing Contents on Stage

Problem

You want to cause an element to undergo a change; for example, appearing, disappearing, or moving.

Solution

Create a new keyframe and modify the element in the new keyframe.

Discussion

Flash has two types of frames: keyframes and frames. Keyframes are special frames in which you can specify a change. The first frame of every layer in a timeline is always a keyframe. Frames merely extend the duration of keyframes. That is, frames are dependent on and inherit from keyframes; they cannot contain any information beyond that found in the preceding keyframe.

Keyframes and frames are represented differently as well. A keyframe is depicted in the timeline with a circle. A solid circle appears if there is stage content (such as graphics or text, but not ActionScript) in the keyframe. A hollow circle appears if the keyframe lacks stage content; these kinds of keyframes are called blank keyframes. Frames with content—both keyframes and regular frames—are shaded gray, while blank keyframes and frames are white. Because frames are dependent on the keyframe that precedes them, the pairing of a keyframe and all successive frames can be thought of as a unit; this unit is called a frame span. A frame span ranges from the keyframe to the last regular frame before the next keyframe or until no more frames exist in the timeline. The last frame in a frame span has an empty rectangle in it.

Keyframes are obviously more powerful than frames, but they also add (negligibly) ...

Get Flash 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.