When working with multiple .swf files that use the same class, compiling that class into every .swf is a waste of space. When file size is a concern, we can prevent such redundancies by producing a class library in the form of a separate .swf file and loading that .swf file at runtime. Once the library has loaded the first time, it is cached on the end user's machine and can be reused by other .swf files without being downloaded again.
The process of creating and using a .swf-based class library is more complex than using a .swc-based class library. Consequently, you should use .swf-based class libraries only when you wish to make your application's file size as small as possible.
The following sections describe first, how to create a .swf file containing a class library, and then how to use classes from that library in an application.
To demonstrate the process of creating a .swf file containing a class library in Flex Builder 2, we'll again return to the beavercore example. The following steps describe how to create a class library, named beavercore.swf, that contains a single class, TextAnimation (we'll assume we're starting from scratch, even though some of the following steps are repeated from the earlier section "Creating a .swc-Based Class Library in Flex Builder 2").
In Flex Builder, select File → New → Flex Library Project.
In the New Flex Library Project dialog, for Project name, ...