4 Replies Latest reply on Oct 24, 2007 6:54 AM by codetale

    Extra classes in my SWF even never use

    codetale
      I am using FlashDevelop3 and Flex2 SDK(compiler) to create my SWF

      but i found the compiler compile extra classes into my SWF even i have never use them.
      the extra classes are all classes in "mx" package.
      (i know this, because FD3 have a feature that allow me to see what all used Symbols and Classes in SWF)

      and i also found that, those "mx" classes are only compiled into my SWF, when i use
      [Frame(factoryClass="")]
      in order to create 2 frames SWF

      anyone any idea on this?
      anyway to exclude the "mx" package? because it make my SWF much more bigger(about 100KB)
        • 1. Re: Extra classes in my SWF even never use
          atta707 Level 2
          100kb is 'at least' that a Flex program would take. There is no way around it. you'll need to go to simple Flash app if you don't need all these mx.* classes.

          ATTA
          • 2. Re: Extra classes in my SWF even never use
            codetale Level 1
            but i do not think that all mx package are necessary, because when i use only the others Tags like Embed, it only include the few required classes like mx.core.FlexBitmap, mx.core.BitmapAsset

            if said that Frame Tag required whole mx.core, that reasonable, but why also
            mx.effects, mx.control, mx.skin and mx.preloader and much more?
            • 3. Re: Extra classes in my SWF even never use
              buabco Level 1
              I'm afraid it's a lot more complex than that. When you add MX classes to your project, you are also adding all the skins and other shared librarys associated with them, also there are a lot of helpper classes that are incorporated. All in all that's what weight 100 KB. You'll notice that that number gets bigger as you add more mx classes to your proyect as the extra classes are incorporated.

              If you want to make things lighter you should work directly with actionscript and create your own classes, you'll notice that if you make your stuff simpler enough you will be able to get under the 100 kb.

              Also if your applicaction is complex enough you can use modules, witch optimize the compilation of classes so you can load the application in smaller pieces and not load the same classes twice making the modules lighter and faster to download.
              • 4. Re: Extra classes in my SWF even never use
                codetale Level 1
                thankyou for reply

                actually i using none of the mx.* classes
                it was automatically include by the compiler when i using the metadata tags,
                but not much of them, just 2,
                [Frame] to create 2 framed swf SWF, so that my preloader can work well
                [Embed] to include the pictures(png)

                it very strange, and not reasonable to making 2 framed SWF have to include all the mx package. like mx.skin, it totally never will show in my application.
                when using only [Embed] tag, it only include few classes that seem really required, they are
                mx.core.BitmapAsset
                mx.core.FlexBitmap
                mx.core.IFlexAsset
                mx.core.IFlexDisplayObject
                mx.core.IRepeaterClient
                mx.utils.NameUtil


                may be who know deep into Flex2 compiler core architecture can tell me why [Frame] tag required all those "seem" unnecessary classes to be included.

                i try to use the Flex3beta2 compiler, but the still same result are produced.

                or is there other way to produce multi frames SWF with flex2 compiler?