From FDT Documentation

Revision as of 16:13, 18 April 2011 by Aklement (Talk | contribs)
Jump to: navigation, search
Apparat 1.png

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.


Getting Started

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.

Download Apparat

Apparat 2.png

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.

Apparat 3.png

Download Scala

Scala 1.png

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.

Scala 2.png

Setting Up FDT & Apparat

Apparat 4.png

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.

Apparat 6.png

To begin, right click on a project and select Properties.

Apparat 7.png

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.

Configuring Apparat

Apparat 11.png

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.

Using Reducer

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

Apparat 5.png

If you're using the provided Apparat Example Project, running the 'No Apparat' launch configuration.

Apparat 8.png

FDT will then create a simple .SWF that is 740 bytes.

Apparat 9.png

Next, choose and run the 'Reducer Demo' configuration.

Apparat 10.png

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

Apparat 12.png

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 and notice that this is embedding an image.

Apparat 14.png
Get FDT5