Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 68

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

Advertisement

Distributing components as RSLs
One way to reduce the size of your application's SWF file is by externalizing shared assets into
stand-alone files that can be separately downloaded and cached on the client. These shared
assets are loaded by any number of applications at run time, but must be transferred to the
client only once. These shared files are known as Runtime Shared Libraries (RSLs).
If you have multiple applications but those applications share a core set of components or
classes, your users download those assets only once as an RSL. The applications that share the
assets in the RSL use the same cached RSL as the source for the libraries as long as they are in
the same domain. By using an RSL, you can reduce the resulting file size for your
applications. The benefits increase as the number of applications that use the RSL increases. If
you only have one application, putting components into RSLs does not reduce the aggregate
download size, and may increase it.
When you compile your application, you specify the directory location of an RSL file 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.
Set the
option to the mxmlc compiler
Command-line compiler
external-library-path
to specify the location of the RSL file at compile time. Set the
runtime-shared-libraries
option to the mxmlc compiler to specify the relative location of the RSL file when the
application is deployed.
For more information, including information on how to create an RSL file, see Chapter 10,
"Using Runtime Shared Libraries," in Building and Deploying Flex 2 Applications.
Example: Compiling a custom formatter component
This section contains an example that uses a custom formatter component that is defined as
an ActionScript file. The name of the formatter is MySimpleFormatter, and it is defined in the
file MySimpleFormatter.as. For more information on creating customer formatter
components, see
Chapter 13, "Creating Custom Formatters," on page
207.
The process for compiling an MXML file is the same as for an ActionScript file. For an
example of deploying an MXML file, see
Chapter 7, "Creating Simple MXML Components,"
on page
77.
68
Compiling Components

Advertisement

Table of Contents
loading

Table of Contents