Skip to content

Don't forget to optimize

June 6, 2007

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 :

–optimize=true

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.

Advertisement

From → Flash Builder

3 Comments
  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. Can you give an example. Class files, graphics, etc.?

  3. 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 com.company.CustomClass;”-alikes becomes large. If you remove all the unused ones, you can shrink an swf with a few 100KBs (with the bigger ones)

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.