Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 67

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

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:
Open the Project Properties dialog box, and then select Flex Build Path to set
Flex Builder
the ActionScript classpath.
Command-line compiler
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:
Open the Project Properties dialog box, and then select Flex Build Path to set
Flex Builder
the library directories that contain the SWC files.
Command-line compiler
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.
Use the
source-path
Set the
library-classpath
option to the mxmlc compiler to specify
option to the mxmlc compiler to
Compiling components with Flex 2 SDK
67

Advertisement

Table of Contents
loading

Table of Contents