3 Replies Latest reply on Jul 12, 2007 2:20 PM by GordonSmith

    Flex SWF size question

      Looking at the sample .mxml files from the tutorials on the adobe site, there seems to be a lot of size added to an swf document created by flex sdk. For example, the EmbeddingSwfFiles sample just embeds a 26.5 KB hourglass.swf movie, but is 122kB big. Why?
      Also, playing with the code in EmbeddingSwfFiles.mxml, modifying the line
      addChild (myButton);
      this.addChild (myButton);
      decreases the size of the resulting swf with 2 bytes. Why? There seems no logic behind it.
        • 1. Re: Flex SWF size question
          Good eye. We watch these numbers closely.
          (1) This is the overhead of using Flex.
          (2) I created some sample apps and compiled several times. On my Mac, with a recent internal build, a Flex app with just an mx:Application tag is 142038 bytes. I added code to create a button (pasted below), and compiled it many times. The resulting swf was 142154 to 142157 bytes, so I wonder if that's what you're seeing, instead of the addition of "this" causing the increase. If you recompile over and over, do you see the same size or some variation?

          Here's the code I was using:

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="doCreationComplete()">

          import mx.controls.Button;

          private var button:Button = new Button();

          private function doCreationComplete():void{

          • 2. Re: Flex SWF size question
            discoguy77 Level 1
            Check out Persistent Framework Caching on this page.
            This will presumably eliminate (much of) the overhead of using Flex.
            • 3. Re: Flex SWF size question
              GordonSmith Level 4
              A little more detail about "the overhead of Flex"... Even if all you've used is the <mx:Application> tag, you're bringing in all kinds of standard Flex-framework functionality such as CSS styles, focus management, deferred instantiation, containers that support layout management and scrolling, localization support, etc. The Flex framework was designed with real-world applications in mind and hasn't been optimized to make demos as small as possible.