views:

363

answers:

2

Hey,

I would like to take advantage of Adobe's Runtime Shared Library system for swc's, but I'm not sure how it ACTUALLY works, like the programming behind it. I understand that it allows you to load SWCs at runtime, but how does it do that?

I'm asking because I would like to try to mimic something like the Signed RSL "swz" system Adobe uses to cache the Flex Framework into the Flash Player, so if you ever visit a site that downloads the Flex framework for some flash website, then the next time, and forevermore, you don't have to download it again.

I can't do this because I'm using my own version of the Flex SDK from the Sandbox, and I have like 5 other swc's I'm using (Mate, RestfulX, etc.). I would like to be able to cache these things permanently, and only have them re-download them if they change.

How do I do that, or what should I read, other than the Adobe RSL docs and such? Can I use javascript or ruby to do this?

A: 

The sad answer is that it's not possible. SWZ files are only to be used by adobe for their Flex framework. However, if you link your swc's as RLS, there might be something like the browser's own caching mechanism kicking in.

sharvey
my question then is, how do I control that browser's caching mechanism from javascript?
viatropos
I don't think you can bypass the browser's setting for that.
sharvey
Browser caching happens inherently so there is no way to control it. All that you can do is request a URL and if the browser wants to cache the contents of that URL then it will.
James Ward
A: 

A SWC is only used by the Flex compiler. It's really just a ZIP file that contains a SWF file with the compiled classes in the library and a XML descriptor file of what is in the SWF file. So SWC files can't be used directly as RSLs since an RSL is just a SWF file that gets loaded before a Flex application starts up.

The Flex preloader will load any RSLs that are referenced when the Flex app is compiled. In some cases these RSLs will be cached by the browser since they are just SWFs. Most browsers do not cache SWFs loaded over https.

Flash Player has a special SWF cache that is not URL specific (like the browser cache). In order to get stuff into that cache it must be signed by Adobe. Today the only SWFs that are being signed are the Flex framework and data visualization RSLs. For privacy reasons Adobe doesn't foresee changing this policy (research cache sniffing if you want to understand why).

You can easily create your own RSLs that may be cached by the browser. You can do this either in Flex Builder by specifying a library to be an RSL or by using the compiler directly. You can use compc to create a SWC and then extract the SWF file out of the SWC for use as an RSL. But be careful since many SWCs unfortunately include their dependencies in the SWC (usually the Flex framework). So you might have to do some optimization of the SWC before you use it's SWF as an RSL. There is also an optimizer tool in the Flex SDK that you can use to automate this process.

James Ward
I'm still uncertain, could I then just create an RSL for the Flex SDK?
viatropos
without having it signed?
viatropos
You can create a RSL for any classes that you want. That RSL can't use the FP cache but may get cached in the browser.
James Ward