Chapter 13. Movie Clips

Every Flash document contains a Stage—on which we place shapes, text, and other visual elements—and a main timeline, through which we define changes to the Stage’s contents over time. The Stage (i.e., the main movie) may contain independent submovies, christened movie clips (or clips for short). Each movie clip has its own independent timeline and canvas (the Stage is the canvas of the main movie) and can even contain other movie clips. A clip that contains another clip is referred to as that clip’s host clip or parent clip.

A single Flash document can contain a hierarchy of interrelated movie clips. For example, the main movie may contain a mountainous landscape. A separate movie clip containing an animated character can be moved across the landscape to give the illusion that the character is walking. Another movie clip inside the character clip can be used to independently animate the character’s blinking eyes. When the independent elements in the cartoon character are played back together, they appear as a single piece of content. Furthermore, each component can react intelligently to the others—we can tell the eyes to blink when the character stops moving or tell the legs to walk when the character starts moving.

ActionScript offers detailed control over movie clips; we can play a clip, stop it, move its playhead within its timeline, programmatically set its properties (like its size, rotation, transparency level, and position on the Stage) and manipulate ...

Get ActionScript: The Definitive Guide 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.