6 Replies Latest reply on Jun 25, 2007 8:05 AM by Omar_Gonzalez

    Problem with RSLs

    Omar_Gonzalez
      So I'm working on an application that's based on the 2.0.1 framework. The application is made of several Flex SWFs on a page so I've implemented RSLs for the framework.swc.

      The problem is the framework.swf is over 1 megabyte. This causes Safari to skip caching the framework.swf file, downloading it each time instead of using a cached version.

      Has anyone come up with any solutions to this problem?
        • 1. Re: Problem with RSLs
          Darrell Loverin Level 4
          Check out the information here: http://www.jamesward.org/wordpress/2007/02/19/faster-flex-applications-shrink-your-rsls/

          Without following the four steps in the above post, even if you just compile the swc with -debug=false, you will see a nice reduction in size. This is because the default value of -debug for compc is true.

          -Darrell
          • 2. Re: Problem with RSLs
            Omar_Gonzalez Level 1
            I don't use the command line compilers, I'm using the Flex Builder features to make the RSLs, which auto-extract the framework.swf and puts it in the bin folder.

            I tried adding -debug=false to the compiler arguments but the SWF created was still the same size.

            Any ideas how to get the same result with the Flex Builder options?
            • 3. Re: Problem with RSLs
              jspiro Level 1
              Could you provide more clarity on your project set up:
              What projects are building what files, their dependencies on each other, who is an RSL, who is the main SWF, are you using the supplied 201 framework.SWC, are you building your own framework.SWC RSL (if so, how -- are you using James' suggestions?)?

              You said "framework.swf" was over 1mb, I'm not sure if you mistakenly wrote SWF when you meant SWC, or if your application is over 1mb and you mistakenly wrote "framework" instead of "myapp.SWF".

              Not trying to be pedantic, but I want to be clear on what you're trying to do before throwing out suggestions :)
              • 4. Re: Problem with RSLs
                Omar_Gonzalez Level 1
                The last attempt was with the default framework.swc for Flex Framework 2.0.1 Hotfix 2.

                The framework.swf that is over 1mb is the SWF that gets outputted into the bin folder when I compiled the application.

                The way I got this was by going to the project properties. In the Flex Build Path I set Default link type: to RSL. Then I selected the framework.swc in the Flex 2.0.1 Hotfix 2 list and changed the Link Type to use the same as default. With the auto-extract the swf to rsl url option checked it produced the framework.swf in the bin folder for me, which is the file I'm trying to reduce in size. It being over 1 meg causes Safari not to cache the framework.

                This is all in Flex 3 beta. Originally the project was set up in Flex 2.0 Builder. There I was using the small, medium, large framework SWFs and I would have one SWF load with the framework, and then it would launch the rest so they didnt all simultaneously download the framework swf. Now that I'm using this default one that is over 1 meg I can't get the same effect in Safari, but it works in Firefox.

                Is that a little more clear?
                • 5. Re: Problem with RSLs
                  Darrell Loverin Level 4
                  What you need to do is optimize the size of the framework.swf RSL. The Flex Builder 3 Beta comes with an optimized framework RSL in the framework/rsls directory. For 2.0.1 you can create your own from the existing framework.swf RSL. Once you have the framework.swf file, go to the RSL properties for framework.swc and uncheck the "auto extract" property. This will keep the optimized file that you are going to create from being overwritten. Next you will need to go to the command line prompt and change directories to where the framework.swf is located. Next run the optimizer.exe program in the Flex 3 Beta SDK like this:

                  > optimizer framework.swf -output framework_opt.swf

                  Next delete the original framework.swf and rename framework_opt.swf to framework.swf. Now you should see about a 60% size reduction in framework.swf.


                  -Darrell Loverin
                  • 6. Re: Problem with RSLs
                    Omar_Gonzalez Level 1
                    Thanks Darrel, that's exactly what I was looking for!

                    The optimizer turned my original framework.swf from 1.09 Mb to 461kb!

                    Thanks again...