| Building and Deploying Flex 2 Applications > Building Flex Applications > Using Runtime Shared Libraries > Using RSLs | |||
To use RSLs when compiling your application, you use the following application compiler options:
runtime-shared-libraries Provides the run-time location of the shared library. external-library-path|externs|load-externs Provides the compile-time location of the libraries. The compiler requires this for dynamic linking.Use the runtime-shared-libraries option to specify the location of the SWF file that the application loads as an RSL at run time. You specify the location of the SWF file relative to the deployment location of the application. For example, if you store the library.swf file in the web_root/libraries directory on the web server, and the application in the web root, you specify libraries/library.swf.
You can specify one or more libraries with this option. If you specify more than one library, separate each library with a comma.
Use the external-library-path option to specify the location of the library's SWC file or open directory that the application references at compile time. The compiler provides compile-time link checking by using the library specified by this option. You can also use the externs or load-externs options to specify individual classes or an XML file that defines the contents of the library.
The following command-line example compiles the MyApp application that uses two libraries:
mxmlc -runtime-shared-libraries=
../libraries/CustomCellRenderer/library.swf,
../libraries/CustomDataGrid/library.swf
-external-library-path=libraries/CustomCellRenderer,
libraries/CustomDataGrid -file-specs MyApp.mxml
The order of the libraries is significant because the base classes must be loaded before the classes that use them.
You can also use a configuration file, as the following example shows:
<compiler>
<external-library-path>
<path-element>libraries/CustomCellRenderer</path-element>
<path-element>libraries/CustomDataGrid</path-element>
<path-element>libs/playerglobal.swc</path-element>
</external-library-path>
</compiler>
<runtime-shared-libraries>
<url>../libraries/CustomCellRenderer/library.swf</url>
<url>../libraries/CustomDataGrid/library.swf</url>
</runtime-shared-libraries>
The runtime-shared-libraries option is the relative location of the library.swf files when the application has been deployed. The external-library-path option is the location of the SWC file or open directory at compile time. Because of this, you must know the deployment locations of the libraries relative to the application when you compile it. You do not have to know the deployment structure when you create the library, because you use the compc command-line compiler to create a SWC file.
|
TIP |
|
The playerglobal.swc file is the default external library that defines the base classes for Flash Player. |
In the previous example, the file structure at compile time looks like this:
c:/appfiles/MyApp.mxml c:/libraries/CustomCellRenderer/CustomCellRenderer.swc c:/libraries/CustomDataGrid/CustomDataGrid.swc
The presence of the library.swf at compile time is not actually necessary. The Flex compiler does not verify the SWF file's existence, but does compile the location specified by the runtime-shared-libraries option into the application code.
The deployed files are structured like this:
web_root/MyApp.swf web_root/libraries/CustomCellRenderer/library.swf web_root/libraries/CustomDataGrid/library.swf
For more information about using the compilers, see Using the Flex Compilers.
Flex 2
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flex/2/docs/00001523.html
Comments
No screen name said on Aug 7, 2006 at 2:50 PM :