Specifications
215ADOBE FLEX 3
Building and Deploying Adobe Flex 3 Applications
This links the library at compile time, which does not result in any benefits of externalization. The library is not
yet being used as an RSL. If you use the new library as an RSL, the resulting SWF file will be smaller, and the library
can be shared across multiple applications.
Now you can recompile the application to use the library as an external RSL rather than as a library linked at
compile time.
The first step is to compile your application with the
runtime-shared-library-path option. This option
instructs the compiler to specifically exclude the classes in your library from being compiled into your application,
and provides a run time location of the RSL SWF file.
cd project/src
mxmlc -o=../bin/app.swf -runtime-shared-library-path=../lib/mylib.swc,myrsl.swf app.mxml
The next step is to prepare the RSL so that it can be found at run time. To do this, you extract the library.swf file
from the SWC file with any archive tool, such as WinZip or jar.
The following example extracts the SWF file by using the unzip utility on the command line:
cd project/lib
unzip mylib.swc library.swf
mv library.swf ../bin/myrsl.swf
This example renames the library.swf file to myrsl.swf and moves it to the same directory as the application SWF
file.
The next step is to optimize the library.swf file so that it does not contain any debug code or unnecessary metadata.
The following example optimizes the SWF file by using the optimizer tool:
optimimzer -keep-as3-metadata="Bindable,Managed,ChangeEvent,NonCommittingChangeEvent,
Transient" -input bin/myrsl.swf -output bin/myrsl.swf
You now deploy the main application and the RSL. In this example, they must be in the same directory. If you want
to deploy the myrsl.swf file to a different directory, you specify a different path in the
runtime-shared-
library-path
option.
You can optionally run the optimizer tool on the myrsl.swf file to make it smaller before deploying it. For more
information, see “Optimizing RSL SWF files” on page 212.
To use the RSL as a cross-domain RSL, you add a crossdomain.xml file, a failover RSL, and its crossdomain.xml
file to the option, as the following example shows:
cd project/src
mxmlc -o=../bin/app.swf -runtime-shared-library-path=../lib/mylib.swc,
http://www.my-remote-domain.com/rsls/myrsl.swf,
http://www.my-remote-domain.com/rsls/crossdomain.xml,
http://www.my-other-remote-domain.com/rsls/myrsl.swf,
http://www.my-other-remote-domain.com/rsls/crossdomain.xml,
Main.mxml










