Specifications
CHAPTER 8
174
About SWC files
A SWC file is an archive file, sometimes also referred to as a class library, for Flex components and other assets.
SWC files contain a SWF file and a catalog.xml file, in addition to properties files and other uncompiled assets
such as CSS files. The SWF file implements the compiled component or group of components and includes
embedded resources as symbols. Flex applications extract the SWF file from a SWC file and use the SWF file’s
contents when the application refers to resources in that SWC file. The catalog.xml file lists of the contents of the
component package and its individual components.
In most cases, the symbols defined in the SWF file that are referenced by the application are embedded in the Flex
application at compile-time. This is known as static linking. The application compiler only includes those classes
that are used by your application, and dependent classes, in the final SWF file.
You can also dynamically link the contents of SWC files. Dynamic linking is when the entire SWF file is loaded at
run time. To achieve dynamic linking of the SWF file, you must use the SWC file as a Runtime Shared Library, or
RSL. For more information, see “Using Runtime Shared Libraries” on page 195.
SWC files make it easy to exchange components and other assets among Flex developers. You need only exchange
a single file, rather than the MXML or ActionScript files and images and other resource files. The SWF file in a
SWC file is compiled, which means that the code is loaded efficiently and it is hidden from casual view. Also,
compiling a component as a SWC file can make namespace allocation an easier process.
You can package and expand SWC files with tools that support the PKZip archive format, such as WinZip or jar.
However, do not manually change the contents of a SWC file, and do not try to run the SWF file that is in a SWC
file in Flash Player.
You typically create SWC files by using compc, the command-line component compiler. You can also save SWC
files as open directories rather than archived files. This give you easier access to the contents of the SWC file. You
create an open directory SWC by setting the
directory option to true. This is typically only used when you
create an RSL because RSLs require that you deploy the SWF file with your application.
The properties files inside SWC files are uncompiled text files in UTF-8 format. They are used as resource bundles
for localization of Flex applications. Within the SWC file, they are stored in the /locale/locale_string directory,
where
locale_string is something like en_US or fr_FR. For more information, see “Localizing Flex Applica-
tions” on page 1101 in Adobe Flex 3 Developer Guide.










