Don't forget to optimize

My friend Lar sent me a brief post by Mike Britton about optimizing Flex SWF files.  Since we use a lot of Modules in our development, I thought I would give it a try.   In each of your Module Project files, place the following argument :


into the Flex Compiler – Additional compiler arguments field.  This could save you about 20 – 40% in Module SWF size. It does not work in all instances and I am not sure exactly why it does for certain Modules and not for others. 

The other optimization trick is to create a Shared code library that loads into your main application.  This should contain any common managers and also items that may be used across multiple modules, like the List for example.  This will decrease the size of your external Modules.  Remember to include a link report fro the Shared library (–link-report=C:/shrclasses.rpt)  and to include the argument load externs (–load-externs=C:/shrclasses.rpt) into each of your Modules.


  1. I found out that excluding unused imports can decrease your filesize a lot.
    This is especially usefull for public websites which have a fairly large codebase

  2. When, for example, you’re working on a large scale application, where you add/remove lots of code (as you advance in codebase), such as custom components/classes.
    The list of “import;”-alikes becomes large. If you remove all the unused ones, you can shrink an swf with a few 100KBs (with the bigger ones)

Comments are closed.