
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
318
|
Chapter 13: MovieClip Subclasses
programmatically via attachMovie( ) or duplicateMovieClip( ). It is, hence, not
possible to create a functioning MovieClip subclass without a corresponding movie
clip symbol in the Library of a .fla file.
Note that the Flash community uses the term “movie clip” to refer to both movie clip
instances on stage and movie clip symbols in the Library. The difference is usually
clear from context. For example, if I say, “All movie clips must be stored as symbols
in the Library.” you understand that I mean “all movie clip symbols must be stored in
the Library.” But in this chapter, loose terminology can get us in trouble. So I’ll dif-
ferentiate explicitly between “movie clip instances on stage” and “movie clip sym-
bols in the Library” whenever necessary.
Let’s see how this all works in practice by creating a real MovieClip subclass. The
example files discussed in this chapter are available at http://moock.org/eas2/examples.
Avatar: A MovieClip Subclass Example
Our example MovieClip subclass, named Avatar, is an on-screen representation of a
user in a chat room or a game.
For the purposes of this example, we assume that the relationship between our
Avatar class and the MovieClip class is a natural “Is-A” inheritance relationship. In
other words, the Avatar ...