From FDT Documentation
With FDT 4.4 Beta, we've began to support Apparat. Apparat is a powerful framework to optimize ABC, SWC and SWF files. It's open source and looks to push the boundaries of ways for Flash developers to enhance their workflows and applications.
Before starting with Apparat, you'll need to download Apparat and Scala separately. This beta release of FDT 4.4 does not include Apparat or Scala.
Visit Apparat's Download Page for the latest version of Apparat or follow this download link After downloading them, expand the zip file and place them somewhere handy - you'll be linking to these sources shortly.
Next just like when Apparat was downloaded, you'll need to download Scala as well. Scala is a general purpose programming language with some powerful features. Apparat is written using Scala so you'll need both.
Windows users can download it here.
OSX and Unix users can download it here.
After downloading the archive, expand it.
Setting Up FDT & Apparat
Next thing, you'll need to tell FDT where to find Apparat and Scala. This is done via 'Preferences > FDT > Apparat' preferences view. Simply choose the root directory of each.
Adding Apparat To A Project
When you want a project to enable Apparat, you'll have to enable it. Once you do that, all existing and new launchers associated with that project will automatically have Apparat integrated into the build process.
To begin, right click on a project and select Properties.
Next, find Apparat within the project's Properties panel and click 'Enable Apparat for this project'. This will enable Apparat for the existing launchers and any new ones created.
Adding and removing Apparat's features is simple, as can be seen in the above screen shot. By default, FDT will pass in your compiled SWF to Apparat for processing. Since no specific output is defined, Apparat will overwrite the supplied SWF with the optimized one.
This GUI also enables you to add additional arguments. Learn more about Using Apparat's Arguments with FDT.
Apparat's reducer is a powerful feature that is used to compress PNGs and bytecode. From Apparat's README:
You can use reducer for advanced compression of your SWF files. Reducer tries to compress embedded PNG graphics. You can leverage this option also with the ActionScript compiler by specifing "[Embed(src=..., compress=true)]". However to speedup compilation you can ignore the compress parameter and let Reducer do the job since it makes use of multicore architectures.
Simple Reducer Example
If you're using the provided Apparat Example Project, running the 'No Apparat' launch configuration.
FDT will then create a simple .SWF that is 740 bytes.
Next, choose and run the 'Reducer Demo' configuration.
FDT will then create the .SWF that is 740 bytes, then use Apparat's Reducer to shrink it down by 37% to 279 bytes.
PNG Compression With Reducer
Opening up the Apparat panel within your project's Properties View, add an additional argument to Reducer 'q=.5'. This will adjust Apparat's JPEG compression level (see Apparat's README).
- Remember, we only need to pass the argument as 'q=.5' instead of the command line version '-q .5'
Back in Editor view, open the file PNGReducerDemo.as and notice that this is embedding an image.