
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Sharing Classes Without Sharing Source Files
|
339
The remainder of this chapter explains how to distribute a class library without dis-
tributing its source files. Hold on to your hat. The ride’s about to get a little bumpy.
Runtime Versus Compile Time
Once you’ve determined that you must distribute a no-source class library, you need
to decide whether the library should be incorporated at compile time or loaded at
runtime. A class library loaded at compile time is known as a static class library (con-
trast this with a dynamic class library, which, as we learned earlier, is a class library
loaded at runtime). In Flash MX 2004, a static class library takes the form of a com-
ponent .swc file, which is added to a .fla file at authoring time. As we saw earlier, a
dynamic class library takes the form of a .swf file, such as spidercore_runtime.swf.
Dynamic class libraries are loaded into the Flash Player via loadMovie( ). The pros
and cons in Table 14-1 should help you decide which kind of library you should use
in your application.
Whether you prefer to use a static class library or a dynamic class library, if you want
to ship a class library without also shipping the source code, you’ll need to build a
static class library to start with. In the case of shipping a dynamic class library