Using the Flash Player Cache for the Flex framework

Since Flash Player 9.0.60 aka Moviestar got the new feature Flash Player Cache:

“The Flash Player cache enables common components, such as the Flex Framework, to be cached locally and then used by any SWF from any domain. Use of the Flash Player cache can significantly reduce SWF file sizes and speed application download times.”

Flex 3 uses this new Flash Player feature to cache Flex core framework classes. Ted Patrick posted an overview of this feature.

I think this is really a great feature as reducing the filesize/download size of Flex apps is really a great success factor as the user experience really improves with shorter download time. Yesterday Adobe Developer Connection released an article about “Improving Flex application performance using the Flash Player Cache“.

The author Darrell Loverin is in the Flex SDK team and developed the new RSL features in the Flex SDK compiler. The article is a great read and explains all in detail. What you really have to change to use the Flex framework as RSLs is not that big deal.
You compile using Flex Builder

Open project properties, go to Flex Build Path, switch to Library Path and change Framework linkage to Runtimeshared library (RSL).

Now it depends on the configuration of the flex-config.xml located in your sdk_install_dir/frameworks directory. There is the node runtime-shared-library-path which is sets the framework settings. If you also want to include datavisiulization and rpc simply duplicate the node and adjust the values. You should see a lower filesize of your compiled swf. To see the final filesize add the compiler argument debug=false to have no debug info in your swf.

You compile using Ant

I you compile with Ant I assume you use the Flex Ant Tasks. Within the mxmlc-tag add the attribute static-rsls=false and add the runtime shared libraries you like to use. Further you have to copy the libraries (swz and swf) from your sdk_install_dir/frameworks/rsls to your output directory. Check my AntExample build.xml.

You compile with command line
Specifiying RSLs on the command line is described in the article.

4 comments to Using the Flash Player Cache for the Flex framework