
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
338
|
Chapter 14: Distributing Class Libraries
Try it out
We can test our dynamic class library by exporting a .swf file from barkyshome.fla
using Control
➝ Test Movie (Ctrl-Enter on Windows or Cmd-Enter on Mac). The
barkyshome.swf file will not include the TextAnimation class but will have access to it
via the loaded dynamic class library, spidercore_runtime.swf. Remember that the
class library loads because we told it to on frame 1 of barkyshome.fla:
// Load class library.
this.createEmptyMovieClip("spidercore", 0);
this.spidercore.loadMovie("../spidercore/spidercore_runtime.swf");
If you’re following along at home, you should see this text appear in the Output
panel:
Imagine a text effect with great majesty.
Note that if we were to load another class library with its own version of the class
com.spiderservices.effects.TextAnimation, the second version of the class would not
overwrite the first version; it would be ignored. To prevent that kind of name colli-
sion, you should always keep your classes in a uniquely named package, particularly
when working with dynamic class libraries.
Sharing Classes Without
Sharing Source Files
Earlier we learned that it’s easiest to share a class library simply by distributing class
files (that is, .as files). However, you may not want to share a class