Macromedia flex 2 手册
64
Compiling Components
Flex component file types
When you create a Flex component, you can distribute it in one of several different file
formats, as the following table shows:
formats, as the following table shows:
You must take into consideration the file format and file location when you compile an
application that uses the component.
application that uses the component.
About compiling with Flex 2 SDK
Adobe Flex includes two compilers, mxmlc and compc. You use the mxmlc compiler to
compile MXML, ActionScript, SWC, and RSL files into a single SWF file. After your
application is compiled and deployed on your web or application server, a user can make an
HTTP request to download and play the SWF file on their computer.
compile MXML, ActionScript, SWC, and RSL files into a single SWF file. After your
application is compiled and deployed on your web or application server, a user can make an
HTTP request to download and play the SWF file on their computer.
You use the compc compiler to compile components, classes, and other files into SWC files or
into RSLs.
into RSLs.
You can use the compc and mxmlc compilers from Adobe Flex Builder, or from a command
line. For more information on using the compilers, see Chapter 9, “Using the Flex Compilers,” in Building and Deploying Flex 2 Applications, and Chapter 10, “Building Projects,” in Using Flex Builder 2.
line. For more information on using the compilers, see Chapter 9, “Using the Flex Compilers,” in Building and Deploying Flex 2 Applications, and Chapter 10, “Building Projects,” in Using Flex Builder 2.
This section presents some examples of using the mxmlc compiler. The most basic example is
one in which the MXML file has no external dependencies (such as components in a SWC
file or ActionScript classes). In this case, you open mxmlc and point it to your MXML file:
one in which the MXML file has no external dependencies (such as components in a SWC
file or ActionScript classes). In this case, you open mxmlc and point it to your MXML file:
$ mxmlc c:/myfiles/app.mxml
File format
Extension
Description
MXML
.mxml
A component implemented as an MXML file.
ActionScript
.as
A component implemented as an ActionScript class.
SWC
.swc
A component implemented as an MXML or ActionScript
file, and then packaged as a SWC file. A SWC file contains
components that you package and reuse among multiple
applications. The SWC file is then compiled into your
application when you create the application’s SWF file.
file, and then packaged as a SWC file. A SWC file contains
components that you package and reuse among multiple
applications. The SWC file is then compiled into your
application when you create the application’s SWF file.
RSL
.swc
A component implemented as an MXML or ActionScript
file, and then deployed as an RSL. An RSL is a stand-alone
file that is downloaded separately from your application’s
SWF file, and cached on the client computer for use with
multiple application SWF files.
file, and then deployed as an RSL. An RSL is a stand-alone
file that is downloaded separately from your application’s
SWF file, and cached on the client computer for use with
multiple application SWF files.