Accessibility

Table of Contents

Improving Flex application performance using the Flash Player cache

Examining the RSL load order

The order in which RSLs are specified in Flex Builder or on the command line matters. A loaded RSL must not have any classes undefined. If there are undefined classes, Flash Player throws a VerifyError. Let's look at what would cause an RSL to have external dependencies and how to control the load order in Flex Builder and the command line.

An RSL is, in the simplest case, the library.swf pulled from a SWC. It represents the collection of classes in the SWC. If the SWC is built with the -external-library-path option, then that SWC will have external dependences. For example, datavisualization.swc (not part of the free SDK) is built with framework.swc on the external library path (-external-library-path+=libs/framework.swc). Making framework.swc an external library reduces the size of datavisualization.swc because it does not contain any of the framework.swc code it requires. When you statically link an application using datavisualization.swc, you don't have to think about external dependences because framework.swc is on the library path (-library-path). Therefore its classes are available at compile time and are linked into the application automatically.

Now let's say your application is working while statically linked and we decide to link datavisualization.swc as an RSL. When the applications runs, you get a VerifyError loading the RSL. The problem is that datavisualization.swc is dependent on framework.swc. It follows that the datavisualization RSL is dependent on the framework RSL. The application loaded the datavisualization RSL but not the framework RSL. The framework RSL not only needs to be loaded, but it must be loaded before the datavisualization RSL. That way, when the datavisualization RSL is loaded, all of the classes it needs from the framework RSL will be available.

How can the RSL load order be controlled? In Flex Builder, the order of the SWCs in the Library Path tab controls the RSL load order (see Figure 11) .

Load order dictated by the ordering used
to list the RSLs in the Library Path tab

Figure 11. Load order dictated by the ordering used to list the RSLs in the Library Path tab

To change the load order, select a SWC and then use the up and down buttons to change its location in the list. When using the command line, the order of the -runtime-shared-library-path options controls the load order of the RSLs.

Where to go from here

You should now be able to use RSLs to reduce the size of your applications by using the Flash Player cache to persist the Flex framework RSLs. Try using the Flex RSLs in your applications and see how much download time you can save.

To research further and to get more development tips, see the following articles in the Adobe Developer Connection: