Apparat is now Open Source

The full source code of Apparat is now available at GoogleCode. It is the whole framework behind TDSI and Reducer.

Apparat is released under the GNU Lesser General Public License. Please contact me if you want to contribute to this project. Maybe someone is interested in writing an Ant task for Reducer? I am also happy to receive feedback if you have used the framework to build something cool with it.

Please join the Apparat Discussion Group if you are interested in collaboration.


  1. Posted Aug 12, 2009 at 12:42 am | Permalink

    Could this aid development of something like Loom, a bytecode weaving AOP project for AS3? There has been no code posted yet but it seems like maybe Apparat could help?

  2. quarkus
    Posted Aug 12, 2009 at 12:51 pm | Permalink

    Here is a simple ANt-Task to call Reducer:

    Could be configured with defined properties.
    Thanks for this great tool !

  3. Posted Aug 12, 2009 at 2:23 pm | Permalink

    quarkus: Sorry but WordPress strips all XML tags. For the Ant Task I was thinking about a Java solution.

  4. Posted Aug 13, 2009 at 10:55 am | Permalink

    Exciting exciting exciting! Let’s see where this goes.
    You really are becoming the Luke Skywalker of better as3/abc.

  5. Jonas
    Posted Aug 18, 2009 at 4:53 pm | Permalink

    For Reducer, it seems there is no way to set individual quality factors for different bitmaps – and maybe it’s a tricky task. When parsing the file, is there a way to find the original bitmap file’s name, so that one can match each DefineBitsLossless2Tag with an argument sent to the Reducer tool?

  6. Posted Aug 18, 2009 at 5:04 pm | Permalink

    The original filename is lost after exporting a SWF. You could write a GUI that shows each picture and a quality slider right next to it. In that case it is no problem to have individual levels. But I do not see this option for the command line now.

  7. Jonas
    Posted Aug 18, 2009 at 5:10 pm | Permalink

    I feared as much. Do you know, though, if the mxmlc preserves the order in which the [embed]‘s were found when generating the swf? That would let me achieve the same result (for the “Embedder” tool I’m writing).

  8. Posted Aug 18, 2009 at 5:13 pm | Permalink

    Sorry Jonas, I have no idea about the order. Especially not when you think about other libraries that are embedded as well and they contain embeds too.

  9. Jonas
    Posted Aug 18, 2009 at 6:04 pm | Permalink

    I can confirm that it does not keep the order even in flat structures, and I can’t see any pattern either.

    For my purposes, I guess I could identify them by checking pixel size and/or pixels with the list of files I’m sending to my tool, but it’s not a pretty solution.

  10. pallzoltan
    Posted Jan 13, 2011 at 12:28 pm | Permalink

    Joa, i was writing a racing game where I’ve used box2d and thought it would be a good idea to replace all Math functions with FastMatch and then put the file through your Apparat. It did help a bit, and I was glad about it, but then it ruined the physics engine…
    So my question is if the FastMath is 100% compatible with the native AS3 Math.
    Great stuff otherwise :)

  11. Posted Jan 16, 2011 at 3:16 pm | Permalink

    No, since the trigonometric methods and square root are just approximations.

    Your physics engine will probably fail when using those methods because of the chaos theory. That means the small error will accumulate and your running simulation fails.

    This means it is okay to update normals using FastMath.rsqrt to render a frame for instance, but anything that involves “x += FastMath.rsqrt(…)” will fail.

  12. Sankar
    Posted Jan 26, 2011 at 12:46 am | Permalink

    Hi Joa,

    Is there any issues running apparat on style swfs when using the LZW option ?

    When I run it without LZW, i.e.reducer -i $file -o $file i get a compression of 1.74 % and the swf loads up fine

    with the -l true option applied on the reducer, the swc fails to load with the following errors

    time 17:06:14.260 :: app.core.startup.LoadStylesheet :: Error loading compiled stylesheet: url=main.swf?version=0.1595955528318882, error=SWF is not a loadable module
    setTitle(Object { name=”title”})history.js (line 482)
    [Break on this error] backStack[backStack.length – 1].title = title;\n
    history.js (line 482)
    time 17:06:14.276 :: :: work item failed: name=Loading Application Styles
    (?)() (line 54)
    (?)() (line 12)
    [Break on this error] \n
    (line 54)
    time 17:06:14.291 :: :: work item failed: name=app Bootstrap
    (?)() (line 54)
    (?)() (line 12)
    [Break on this error] \n
    (line 54)
    time 17:06:14.291 :: :: work item failed: name=Initializing app Core
    (?)() (line 54)
    (?)() (line 12)
    [Break on this error] \n
    (line 54)
    time 17:06:14.307 :: app.core.startup.LoadStylesheet :: Error loading compiled stylesheet: url=main.swf?version=0.1595955528318882, error=Unable to load style(SWF is not a loadable module): main.swf?version=0.1595955528318882.
    (?)() (line 54)

5 Trackbacks

  1. […] Update: Reducer is now open source! […]

  2. […] Update: TDSI is now open source! […]

  3. By [Flash CS4] - SWFs komprimieren - Flashforum on Jan 22, 2010 at 2:35 am

    […] […]

  4. […] Apparat […]

  5. […] C. ¬†We have certain limitations (no threads, a VM vs. all code being machine code, and a lot of missing optimizations). ¬†Brandon Hall once said if you have a performance problem in Flash, you’re probably doing […]