QueTwo's Blog

thouoghts on telecommunications, programming, education and technology

Deploying RSLs in Flex


RSL’s?  Runtime Shared Libraries are a technology that was introduced in Flex 3.0 that allowed our Flex applications to load much, much quicker.  What they really are is the shared libraries that we deploy for ALL of our applications (like the Flex Framework and common controls, or the data visualizations) in a separate download for the end user.  The end user will store these common libraries in their player cache after they have been first downloaded.  This means that they will "never" have to download those bits again.  Your 600k Flex application all of a sudden went to a 200k app with a 450k framework download.  However, the next time a user visits your site, they only need to download the 200k app, since the framework will already be on their PC.

Sounds like a good deal, right?  If you use the official Flex 3 builds (http://opensource.adobe.com) then this code is digitally signed, and there is essentially no penality in deploying this bandwidth saver. The nice thing too is each version of the framework that the user downloads is stored separately, so you know that if you target your app for a specific Flex 3/4 SDK, that the user will always have that version.

Who should not use RSLs? Anybody who monkey-patches the framework, or has their own build of the SDK should NOT use RSLs.  Everybody else pretty much should.   If you don’t know what that means, then you’re OK :)   RSLs also up the requirement of the Flash player to 9.0.115, rather than 9.0.0, which may pose a problem for a few people that haven’t upgraded in a very long time.

How do you enable it?  That’s pretty simple too!   All you have to do is right click on your Flex Builder project, and go to the properties menu option.  Click on the Flex Build Path node, and then the Library Path tab.  Change the Framework Linkage from "Merged" to "RSL".   If you don’t want to customize your deployment, that should be all you have to do.

By default, you will be able to deploy your app with any signed bit of code as an RSL. This includes the Framework, the RPC code, and the Data Visualization code.  You can customize this by deploying unsigned RSLs, of your own code and modules.  This means that certain modules can be separated out and stored on the user’s machine as well.  Open the node of the code that you want to enable as an RSL in the Library Path tab, and click on the Link Type node.  Click on Edit… to change the link type.  In the resulting dialog box, you should be able to change the link type to RSL. You can also choose to deploy the code as a trusted cache (which means that as long as that the SWF’s filename will be used as the verification), or you can enable Digest mode, which is essentially a CRC check on the SWF to make sure it is the right version.  I would suggest Digest mode (although there is a very, very small processor penalty to enable it).

So, now you’ve got your project setup for RSL’s, how do you deploy it? You can deploy this project just as you would any other project — by coping over the SWF files to your web serer.  The only difference here is you will need to copy a few other sets of files.  In your release directory (after you export a release version of your code), you should now see additional files for every RSL enabled bit of code you setup.  For example, your framework will now show
framework_3.0.build_number.swz in addition to your normal SWF output.  Make sure these files end up on the web server as well.  You will see SWZ files for signed bits of code, and SWF files for unsigned bits.

In my own setup I did run into one issue when I was moving my app into production.  Apparently recent versions of IIS won’t serve files that don’t have MIME-Types associated with them.  After deploying my app to the server, I was getting RSL Digest Error displayed in the the browser when I was deploying.  The problem was I was not the one seeing these errors, but rather my customers.  Because IIS didn’t have a mime-type setup, it would give 404 errors for the SWZ files for those people who hadn’t downloaded those files. To fix the issue, add a new mime-type of x-shockwave-flash associated with the .swz file extension.  Things should work then.

Enjoy your faster downloads!


7 responses to “Deploying RSLs in Flex

  1. john April 9, 2009 at 9:22 am

    thanks buddy , my mime type was not added to iis and i was wondering what has happened to it .

  2. Jeff Conrad April 21, 2009 at 5:05 pm

    According to this technote,


    the official mime type of a SWZ is “application/x-swz”.

  3. Mark Brindle May 21, 2009 at 9:54 am

    Thanks. I have tried this with Flex Builder 3 and the current 3.3.0 framework. Everything seems to work BUT my charts are missing axis text. If I turn off RSL, their back!

    Any ideas?

    • quetwo May 21, 2009 at 11:20 am

      That seems really odd. Turning on RSL’s and switching to the SWZ really shuold not make any difference at all. My thought to you : does this occur on multiple machines? It may be the SWZ you have is screwed up somehow (remember, there are cached over multiple domains, applications).

  4. Eric November 3, 2009 at 10:00 pm

    I am not seeing the axis text on my charts as well after I went to a RSL for the framework.

    Has anyone found a solution for this?

    • Mark Brindle November 4, 2009 at 1:52 am

      Eric, I gave up!

      Nothing I did worked. I think it has to do with the fact that the Axis needs an embeded font (for rotaton) and the SWZ does not see the font. I’m not sure, but I spent a few days and gave up. It’s a shame though.

  5. Vince Genovese June 1, 2010 at 6:10 pm

    Hi Nick,

    I like this article on Deploying RSLs in Flex. It complements nicely the Flash Builder docs I wrote on this topic: http://help.adobe.com/en_US/flashbuilder/using/WS6f97d7caa66ef6eb1e63e3d11b6c4d0d21-7feb.html#WSbde04e3d3e6474c4-3b463d4f122088382ae-8000

    We’re trying to add more links in our docs so that Flex developers are made aware of the great community content out there. I’m wondering whether you would consider adding a comment with a link to your post to the following page:

    * Your page: http://quetwo.com/2009/01/22/deploying-rsls-in-flex/
    * Our page: http://help.adobe.com/en_US/flashbuilder/using/WS6f97d7caa66ef6eb1e63e3d11b6c4d0d21-7feb.html#WSbde04e3d3e6474c4-3b463d4f122088382ae-8000

    Even though your article refers to FB 3, I think it still applies to FB4.

    Integration of customer-generated content is a key component in the success of the Flash platform documentation, so we really appreciate your contribution. FYI, here’s a blog post with a little more information about community help contributions: http://blogs.adobe.com/actionscriptdocs/2009/08/developers_and_writers_adobe_w.html. This post specifically mentions Adobe AIR but we’re doing this across the entire Adobe Flash Platform.

    Best regards
    Vince Genovese
    Senior Content and Community Lead
    Adobe Systems Incorporated

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: