Flash CS4 Resources
Basics of movie clips
Introduction to working with movie clips
Movie clips are a key element for people who create animated content with the Flash authoring tool and want to control that content with ActionScript. Whenever you create a movie clip symbol in Flash, Flash adds the symbol to the library of that Flash document. By default, this symbol becomes an instance of the MovieClip class, and as such has the properties and methods of the MovieClip class.
When an instance of a movie clip symbol is placed on the Stage, the movie clip automatically progresses through its timeline (if it has more than one frame) unless its playback is altered using ActionScript. It is this timeline that distinguishes the MovieClip class, allowing you to create animation through motion or shape tweens through the Flash authoring tool. By contrast, with a display object that is an instance of the Sprite class, you can create animation only by programmatically changing the object’s values.
In previous versions of ActionScript, the MovieClip class was the base class of all instances on the Stage. In ActionScript 3.0, a movie clip is only one of many display objects that can appear on the screen. If a timeline is not necessary for the function of a display object, using the Shape class or Sprite class in lieu of the MovieClip class may improve rendering performance. For more information on choosing the appropriate display object for a task, see Choosing a DisplayObject subclass.
Common movie clip tasks
The following common movie clips tasks are described in this chapter:
Important concepts and terms
The following reference list contains important terms used in this chapter:
Working through in-chapter examples
As you’re working through the chapter, you may want to test some of the example code listings for yourself. Because this chapter is about working with movie clips in ActionScript, essentially all the code listings in this chapter are written with the idea of manipulating a movie clip symbol that has been created and placed on the Stage. Testing the sample will involve viewing the result in Flash Player or AIR to see the effects of the code on the symbol. To test the code listings in this chapter:
Other techniques for testing example code listings are explained in more detail in Testing in-chapter example code listings.