User Guide
182 Creating Components
Exporting and distributing a component
Flash exports components as component packages (SWC files). Components may be
distributed as SWC files or as FLA files. (See the article on Macromedia DevNet at
www.macromedia.com/support/flash/applications/creating_comps/creating_comps12.html
for information about distributing a component as a FLA.)
The best way to distribute a component is to export is as a SWC file, because SWC files
contain all the ActionScript, SWF files, and other optional files needed to use the component.
SWC files are also useful if you are working at the same time on a component and the
application that uses the component.
SWC files can be used to distribute components for use in Macromedia Flash 8, Macromedia
Dreamweaver MX 2004, and Macromedia Director MX 2004.
Whether you’re developing a component for someone else’s use, or for your own, it’s
important to test the SWC file as an ongoing part of component development. For example,
problems can arise in a component’s SWC file that don’t appear in the FLA file.
This section describes a SWC file and explains how to import and export SWC files in Flash.
Understanding SWC files
A SWC file is a zip-like file (packaged and expanded by means of the PKZIP archive format)
generated by the Flash authoring tool.
The following table describes the contents of a SWC file:
File Description
catalog.xml (Required) Lists the contents of the component package and its individual
components, and serves as a directory to the other files in the SWC file.
ActionScript
(AS) files
If you create the component with Flash Professional 8, the source code is one
or more ActionScript files that contain a class declaration for the component.
The compiler uses the source code for type checking when a component is
extended. The AS file is not compiled by the authoring tool because the
compiled bytecode is already in the implementing SWF file.
The source code may contain intrinsic class definitions that contain no
function bodies and are provided purely for type checking.
SWF files (Required) SWF files that implement the components. One or more
components can be defined in a single SWF file. If the component is created
with Flash 8, only one component is exported per SWF file.