Compiling components with Flex 2 SDK
67
For example, you can create a component for use by a single application. In that case, you
store it in the directory structure of the application, usually in a subdirectory under the
directory that contains the main file of the application. The component is then compiled with
the entire application into the resultant SWF file.
You can also create a component that is shared among multiple applications as an MXML or
ActionScript file. In that case, store the component in a location that is included in the
ActionScript classpath of the application. When Flex compiles the application, it also
compiles the components included in the application’s ActionScript classpath.
You specify the directory location of the shared components by using one of the following
methods:
Flex Builder
Open the Project Properties dialog box, and then select Flex Build Path to set
the ActionScript classpath.
Command-line compiler
Use the
source-path
option to the mxmlc compiler to specify
the directory location of your shared MXML and ActionScript files.
Distributing components as SWC files
A SWC file is an archive file of Flex components. SWC files make it easy to exchange
components among Flex developers. You need to exchange only a single file, rather than the
MXML or ActionScript files, images, and other resource files. In addition, the SWF file inside
a SWC file is compiled, which means that the code is hidden from casual view. Finally,
compiling a component as a SWC file can make namespace allocation an easier process.
SWC files can contain one or more components and are packaged and expanded with the
PKZIP archive format. You can open and examine a SWC file by using WinZip, JAR, or
another archiving tool. 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 outside of the SWC file.
When you compile your application, you specify the directory location of the SWC files by
using one of the following methods:
Flex Builder
Open the Project Properties dialog box, and then select Flex Build Path to set
the library directories that contain the SWC files.
Command-line compiler
Set the
library-classpath
option to the mxmlc compiler to
specify the directory location of your SWC files.
For more information about SWC files, see Chapter 9, “Using the Flex Compilers,” in
Building and Deploying Flex 2 Applications
, and Chapter 10, “Building Projects,” in
Using Flex
Builder 2
.
Содержание FLEX 2 - CREATING AND EXTENDING COMPONENTS
Страница 1: ...Creating and Extending Flex 2 Components Adobe Flex 2...
Страница 6: ...6 Contents...
Страница 10: ...10 About Flex Documentation...
Страница 12: ......
Страница 24: ...24 Creating Flex Components...
Страница 74: ...74 Compiling Components...
Страница 76: ......
Страница 118: ...118 Creating Advanced MXML Components...
Страница 120: ......
Страница 182: ...182 Creating Advanced Visual Components in ActionScript...
Страница 194: ...194 Creating Custom Style Properties...
Страница 204: ...204 Creating Template Components...
Страница 206: ......
Страница 216: ...216 Creating Custom Formatters...
Страница 254: ...254 Index...