7 Replies Latest reply on Sep 16, 2009 11:00 PM by agreeshma

    SWF File size

    agreeshma

      Hello All,

       

      I have created an mxml file with just an application tag and compiled it using Adobe Flex Builder 3. Shockingly, the compiled swf object is of 98KB size.

       

      Here is my MXML -

       

      Sample.mxml

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application

       

      xmlns:mx="http://www.adobe.com/2006/mxml">

      </mx:Application>

       

       

       


      And I have changed Framework Linkage to Runtime Shared Library (RSL) in Flex Build Path --> Library Path under my project's properties and hit Run --> Run Sample. With this, sample.swf got generated which is of 98KB size. Any tips to reduce the swf size are greatly appreciated.

       

      Regards,

      Greeshma

        • 1. Re: SWF File size
          ShardulSingh Level 3

          Hi,

          use '-optimize=true' in your compiler setting it will help you to reduce the size of your swf.

          The another thing that is using RSL is already implemented by you.

          Let me know if it helps you.

           

           

           

           

           

          with Regards,

           

          Shardul Singh Bartwal

          1 person found this helpful
          • 2. Re: SWF File size
            Gregory Lafrance Level 6

            True, an empty app is larger than you would expect, but Flex is a framework and the app contains nothing and is useless right?

             

            Seriously, you can use RSLs as the other poster mentioned.

             

            You can also use modules or multiple SWF files to reduce the size of the SWF, and in a large complex app you surely would want to use modules or multiple SWFs.

             

            http://livedocs.adobe.com/flex/3/html/help.html?content=creating_modules_4.html

             

            http://livedocs.adobe.com/flex/3/html/help.html?content=modular_3.html

             

            http://www.cftips.net/post.cfm/reduce-flex-3-swf-size-by-using-rsl

             

            http://www.adobe.com/livedocs/flex/3/html/help.html?content=performance_07.html

             

            If this post answers your question or helps, please mark it as such.

            1 person found this helpful
            • 3. Re: SWF File size
              agreeshma Level 1

              Thank you very much Shardul and Greg.

               

              I will try and let you know the result.

               

              Actually my swf size was 184 KB and to know where the weight is coming from, I tried with an empty application tag. And this gave me 98KB. My mxml also has a HTTPService tag. So, I placed just a HTTPService tag inside application tag and compiled the object which came to around 150 KB. I want to bring it to below 50 KB. Hope it is possible through modular approach as you suggested. I will also try optimize option.

               

              Thanks again,

              Greeshma

              • 4. Re: SWF File size
                Flex harUI Adobe Employee

                In Flex4 if you use the framework RSLs, your SWF can get about 50K.

                 

                Basically there is a tradeoff to using frameworks.  A framework contains lots of code just in case you need it to save you the time of having to write and debug that code yourself,  but that means you will load that code whether you need it or not.  Try "hello world" in Visual C++ with the MFC framework.  It is a similar proposition.  You can choose to not use the MFC framework and get a smaller SWF.  You can choose not to use the Flex framework and get a smaller SWF as well, but you might spend more time writing the same code that's already in the framework

                 

                Alex Harui

                Flex SDK Developer

                Adobe Systems Inc.

                Blog: http://blogs.adobe.com/aharui

                • 5. Re: SWF File size
                  agreeshma Level 1

                  Thanks Alex.

                   

                  But how do I choose to remove flex framework. And by the way choosing RSL will bundle the framework into SWZ.. isn't it? If not, tell me how to remove the framework option and what exactly will I loose doing so. Will I not be able to use any mx tags?? I am just using mx tags in my mxml.

                   

                  Regards,

                  Greeshma

                  • 6. Re: SWF File size
                    Flex harUI Adobe Employee

                    In FlexBuilder you create an actionscript-only project.  And yes, then you can't use 99% of the mx: tags, just resources and rpc library tags, IIRC.

                     

                    Alex Harui

                    Flex SDK Developer

                    Adobe Systems Inc.

                    Blog: http://blogs.adobe.com/aharui

                    • 7. Re: SWF File size
                      agreeshma Level 1

                      Hello guys,

                       

                      My swf file size was 125KB earlier. I was using mx:HTTPService tag to hit a service. And now I replaced HTTPService with URLLoader and the object size got reduced to 76KB. This is a significant improvement but I would like to bring my swf below 50KB. If my empty application (mxml with just an application tag) produces a 67KB swf file, how can I reduce my real swf to below 50KB? And I have seen some examples on internet where swf files are of 40KB. Does it mean, those swf are not generated through mxml applications?? Please guide.

                       

                      Greeshma