Ted Patrick > { Events & Community } > Adobe Systems


Flex Shared Libraries - Tips and Tricks

I got shared libraries working today with Flex and found some interesting tidbits.&

1. They are very easy to use. Just create a "common.sws" file and denote the tags you want in the shared library. The only change to your MXML file is to denote rsl="common.sws" in the mx:Application tag. Within the common.sws file in the 'library' root tag you can denote the url='/common.swf' as for the runtime location of the shared library. There are also additional options.

2. When you compile your MXML several things happen in regard to RSLs.

a. The RSL URL is embedded into your base SWF. When your MXML SWF file is loaded it will load the URL as a shared library.

b. The Flex server has hooks into compc for creating SWC RSL SWF files on the fly. To create an RSL from an sws file, simply add "swc.swf" to the end of the base name of your .sws file. Here is an example:

common.sws - SWS file denoting Components and RSL URL.
common.swc.swf - Returns the RSL SWF to be saved to the RSL URL location.

3. So if you want to use Shared Libraries without the Flex server, you can simply download the following URLS:

http://myFlexServer/flex/myapp/myapp.mxml.swf
http://myFlexServer/flex/myapp/common.swc.swf

Place these files on any server in the correct path based on the sws url path and you are good to go!

As Darron is sure to post in this entry, you can also use compc to generate RSL SWF files from an SWS file.

Cheers,

ted ;)

3 Responses to “ Flex Shared Libraries - Tips and Tricks ”

  1. # Anonymous JesterXL

    I think you mean "3. So if you want to use Shared Libraries", hehe... it's Friday!  

  2. # Blogger Ted Patrick

    It is so friday! Thanks for the catch, Jesse!

    ted ;)  

  3. # Anonymous Ryan Matsikas

    heh
    I think he really means "3. So if you want to use Shared Libraries without the Flex server, you can simply download and use the following FILES: ... "  

Post a Comment



© 2008 Ted On Flex