Photo credits: Matt Steen

To see more recent blog posts please visit http://www.sanative.net/blog


Flex RSL: Caching, almost but not quite... Quite!

One of the coolest features of Flex 3 is the RSL functionality. When you utilize this option it caches the framework to a swf file. If the user has already visited a site which has a Flex app that is built using the same framework version as you they do not need to download the framework as part of your movie. This means much faster load times and overall, much smaller swf files. It's pretty nifty.

Except there are some catches! A project we are working on is for data driven widgets throughout a website. These should be small in size, no more than 70-80k. We'd reached that goal for the UI functionality at 72k for the most complex swf. That is, until we added in the imports to pull data in from a simple web service. All we do is pull in some small XML packets and parse the data out, a pretty menial task. However, after we imported the soap Webservice (import mx.rpc.soap.WebService) we noticed out file sizes increased by 100k!

Now, one would think this would be cached with the RSLs, but apparently not. Mike Huntington pointed out in the comments that the LiveDocs contains information on the RSL for RPC. After I reviewed the documentation again I found out this is indeed true. Thanks Mike! So, after a bit more research on how to implement this, I came across the Adobe Wiki with instructions on exactly how this is done. I added the RPC RSLS, recompiled the app and was down to a manageable 77k. Nice!

That being said, you may want to monitor your export builds frequently through your development cycle to see what's increasing your SWF sizes and determine if there's a way around it. For backend systems this won't cause much of a ruckus, but if you have Flash apps (or, more appropriately, widgets) for public consumption a 200k swf could be cause for concern.

Comments
Mike Huntington's Gravatar I may be wrong.. but I recall reading in the Flex documentation that if you use any of the rpc classes, you have to include a special SWZ file which loads the caches the rpc part of the framework. But like I said.. I may have misread that. But you may want to look into that.
# Posted By Mike Huntington | 2/27/08 8:19 PM
TJ Downes's Gravatar Mike, looks like you are absolutely correct. I don't know how I missed that in the docs!

Ill update the post to reflect that!
# Posted By TJ Downes | 2/27/08 11:08 PM
BlogCFC 5.8.001 © Ray Camden