Ted Patrick > { Events & Community } > Adobe Systems


RSLBuilder or Put your Flex apps on an RSL Diet

Making the perfect SWS file for RSL creation in Flex is not easy on large projects. The key is to obtain the smallest RSL containing only components in use across several applications. I wrote this Python script to read a filesystem for MXML and generate a perfect SWS file.

Download RSLBuilder

Download Python

This script speed reads all MXML files in a directory recursively and obtains all tags in use in the mx namespace. I have tested the script on both Flex 2 and Flex 1.5 apps and it works perfectly including FlexStore, Flex Explorer, Cynergy Projects, and some 150 IFBIN Flex examples. The output is a perfect SWS file containing only the mx components in use. I typically run the script in the Tomcat WebApps directory to obtain an RSL that optimizes an entire server of Flex apps.

To optimize your application to use the RSL:

1. Add an 'rsl' attribute to your mx:Application tags as follows:
<mx:Application rsl="Custom path to file/common.sws" >

2. Use COMPC to create an RSL SWF file from common.sws and place this SWF file at "/common.swc.swf" on your server.

In many cases, this will remove about 250Kb of redundant size from every Flex app running on your server. If you add a component that is not in the RSL, it will just add some weight to the app where its used. Think of the script as an instant weight loss plan for your entire Flex site, that actually works!

Automation like RSLBuilder has saved me untold hours of time on mind numbing problems. As Flex is XML it can be parsed and machine processed easily, might as well automate it to the nth degree!

Put those Flex apps on a diet with RSLBuilder.py!

Cheers,

Ted :)

4 Responses to “ RSLBuilder or Put your Flex apps on an RSL Diet ”

  1. # Anonymous Kevin Hoyt

    Awesome work, Ted!

    I think RSL's are a highly underutilized feature by most Flex developers. I'm not sure if this is due to awareness (or lack thereof), or due to complexity. Either way, I look forward to passing this little gem on to my customers.  

  2. # Anonymous ilya devers

    Wow Ted, that is really really good stuff.

    Good use of scripting language to improve/speed up work.

    I am more of a ruby man, so i might just port it. Will let you know if i ever get around to it...

    Cheers,

    ilya  

  3. # Anonymous Rostislav Siryk

    Ted, is this possible to use RSLs just as runtime libraries of graphic assets?

    I'm looking for article or simple tutorial on this subject.  

  4. # Anonymous Anonymous

    Could you please provide an email of how to use COMPC?

    Thanks very much,
    Dylan  

Post a Comment



© 2008 Ted On Flash