
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
316
Chapter 13
CHAPTER 13
MovieClip Subclasses
From an application development perspective, a movie clip is a self-contained multi-
media object with a timeline for changing state (you can think of animation in a
movie clip as a rapid succession of visual state changes). Movie clips can contain
graphics, video, and audio. They are, hence, perfect for creating the audio/visual ele-
ments of an application—so much so, that every one of Flash’s own components are,
in fact, descendents of the MovieClip class.
We’ve already seen lots of examples of how movie clips can be used in OOP. Most of
these have involved object composition, in which a movie clip instance is stored in
an instance property and used by a class to represent something visual on screen. In
the composition model, the class that uses the movie clip does not inherit from the
MovieClip class. For example, in the Box class from Example 4-6, we create a movie
clip in which we draw a square shape. We store that movie clip in an instance prop-
erty of the Box class, but the Box class does not inherit from the MovieClip class (i.e.,
it does not extend MovieClip).
As an alternative to object composition, we can use inheritance to marry one of our
own classes to the MovieClip class. When taking the inheritance approach, we
should feel ...