1

I have a pure AS3 project. I use Ant to build it. Here is a part of my ant script:

<target name="mxmlc">
    <exec executable="${flex.home}/${mxmlc}" failonerror="true">
        <arg line="-compiler.include-libraries=${lib}"/>
        <arg line="-compiler.incremental=false"/>
        <arg line="-compiler.optimize=true"/>
        <arg line="-debug=false"/>
        <arg line="-default-background-color=0x${background.color}"/>
        <arg line="-default-frame-rate=60"/>
        <arg line="-default-size 800 600"/>
        <arg line="-static-link-runtime-shared-libraries=true"/>
        <arg line="-source-path='${src}'"/>
        <arg line="'${basedir}/${src}/${src.file}'"/>
        <arg line="-o=${bin}/${output.file}"/>
        <arg line="-use-network=true"/>
    </exec>
</target>

The problem is that my resulting SWF is really big. When I checked what is inside I saw that it has mx.* libs from Flex. Why it is like this? How to kick mx.* from my SWF?

p.s. In my code I don't use anything from mx.* library.

Worker
  • 2,411
  • 6
  • 29
  • 55
  • Hard to say without looking at the source code. Are you sure that Ant is not automatically including the Flex SDK? How does it find the path to the libraries? Maybe you need to edit the default Ant configuration file and comment out the lines where it includes Flex. – laurent Nov 24 '11 at 08:13

1 Answers1

0

Even though your code doesn't import any mx.* classes directly, some of the classes you do import might have imports of their own. Are you using any of the built-in Flash, Flex or Spark components, for example?

Anyway, I wouldn't worry about the mx.* imports, but rather check the assets you are using:

  • Components (Can you do without some and replace them with your own, simpler implementations?)
  • Fonts
  • Images
  • Movies
  • Sounds

These are usually responsible for bloating your SWFs, and adjusting image quality, or reducing the number of characters in an embedded font, for example, can greatly reduce your file size.

weltraumpirat
  • 22,544
  • 5
  • 40
  • 54
  • weltraumpirat, you are right. all my media resources are very well optimized. The problem I see when I open my SWF with SWF decompilers is that code takes more than 90% of my swf... This is very strage.. – Worker Nov 24 '11 at 16:47