Apparat – A custom Matryoshka

A few weeks ago Joa Ebert (@joa) released an update to the Apparat Reducer, adding the option of LZMA compression to further reduce your SWF file-sizes.

It works by squeezing your original SWF with LZMA compression, and injecting that data as a ByteArray into a wrapper SWF - hence the Matryoshka moniker.

The Matryoshka handles decompressing the data with an AS3 implementation of LZMA decompression, and then loads the resulting SWF bytes with a standard Loader object.

This all works beautifully, and you can get pretty decent reductions in file-size, especially on larger SWFs.

After testing it, I took a look at the Apparat sources - in particular the LZMA decoder and Matryoshka wrapper - and noticed that because of the use of the Vector type, the code was only compatible with Flash Player 10 or greater.

With the need to create Flash Player 9 compatible content still the part of many a working day, I felt it was worth trying to build a custom version of Apparat with Flash Player 9 compatible Matryoshka and LZMA decompression...

(more...)