Posts tagged flex sdk
Runtime Shared Libraries – indispensable and infuriating!
Jul 22nd
Utilizing the RSL (Runtime Shared Library) mechanism in Flex is arguably one of the quickest and easiest ways to drastically shrink your Flex application’s file size. The RSL mechanism essentially allows you to compile your Flex application without embedding the Flex framework into the code. So, if the Flex framework isn’t compiled into the Flex application (final SWF file), then how does the application work? The real genius comes in at this point… The Flash Player – as of version 9.0.60 – can now cache signed RSLs containing the Flex framework. If the Flash Player caches these frameworks, it means that if you have viewed a Flex site using the 3.2.0 SDK and you launch another Flex application using the same SDK, you do not have to download the whole framework from the server!
For more information and a brief tutorial, visit this link on the Adobe Labs site.
However, it’s not always as quick and easy as some might like to believe. Recently i’ve been playing around with RSLs and different versions of the Flex SDK and i’ve been encountering the dreaded Error #1001 runtime error. This pernicious and convoluted little error can cause a spontaneous force of attraction between your forehead and your desk. It’s quite strange indeed… Well, after a bit of digging and some messing around, i seem to have noticed a general pattern for failure and subsequently getting the error message above, and how to fix it…
I’ve created a Flex project and have merrily gone about my day coding, styling, flexisizing etc… I’ve set my project to use RSLs (using the 3.2.0 Flex SDK) and everything is working just fine. Now i notice on the Adobe Labs site that there’s a new Flex SDK available (say… 3.3.0). I decide to chuck the current SDK and replace it with the new one… Only to see the following after a compile of the project:
Eek. Nothing like a good ol’ spanner in the works, eh?
After a bit of scratching around in the 3.3.0 SDK folder, i came upon the flex-config.xml file (located at $FLEX_INSTALL_PATH/sdks/$SDK_VERSION/frameworks). If you scour through the file, you’ll see that towards the bottom there’s a node called runtime-shared-library-path. Here’s what it looks like in the 3.3.0 SDK:
<runtime-shared-library-path> <path-element>libs/framework.swc</path-element> <rsl-url>framework_3.3.0.4852.swz</rsl-url> <policy-file-url></policy-file-url> <rsl-url>framework_3.3.0.4852.swf</rsl-url> <policy-file-url></policy-file-url> </runtime-shared-library-path>
Check out the two rsl-url properties… One is the name of a SWZ (signed SWF) file and the other is a plain SWF file… Notice the naming of those URLs and then refer back to the image above. Flex Builder obviously didn’t change the RSL linkages when i changed my SDK in my Flex project.
The SOLUTION:
Open your Flex Project Properties dialog, select the Flex Build Path option on the left, then the Library Path tab at the top. You will then see something like this:
Notice how the version numbers of the RSL files do not correlate with the version of Flex SDK? For some reason, Flex doesn’t change the RSL linkage when you switch SDKs in a Flex Project. I wonder whether this is a bug or a feature (like i often wonder about the ON button on Windows machines).
Anyway, the quick fix for this is as follows:
Simple select the Flex SDK and hit the REMOVE button on the right. The Add Flex SDK button will then become active and you can go ahead and click on it. This will scan the flex-config.xml file we looked at earlier and pick up the correct files to use for the RSL.
Done! You can now close the Properties dialog.
Go ahead and clean your project at this point by going to the menu, Project -> Clean. This will delete all the compiled code that was previously generated and it will then trigger a new build. Once the build has completed, run your Flex application…
Oh, don’t you just love it when shit works?!

