Zipped Assets

Daniel Sperl
Unzip individual assets right while they are loaded
assets, zip, AssetManager


This extension requires Starling 2.4 with its new AssetManager.

Some assets, especially JSON and XML files, can take up quite a lot of disk space. That can increase the install size of an app or game significantly.

Fortunately, though, many of those assets also compress very well when zipped – let's exploit that! With this extension, you can compress individual assets as zip-files and let them be decompressed by the AssetManager.


First, use a ZIP-tool of your choice to compress the relevant assets. Each zip file must contain one (and only one!) asset. The file name of the zip file is actually not relevant – the AssetManager will only look at the filename found inside the zip-file. Nevertheless, I recommend the following name scheme so that you easily see what's inside:

  data.json =>
  font.xml =>
Don't blindly zip each and every file. For example, zipping doesn't make MP3, JPG, PNG or ATF files any smaller. If you zip those files, you'll just make the load process take more time and memory.

To “install” this extension in your game, simply download the ZipLoader class from the Gist-link above and copy it to your game project. Furthermore, you need a copy of the FZip library. Download the swc library from here and add it to your project, as well.

Using the class is really easy: you simply assign a new ZipLoader instance to the AssetManager's dataLoader property and, bam, it will unzip files automatically and transparently!

// instantiate the standard AssetManager
var assets:AssetManager = new AssetManager();
// assign the "ZipLoader"
assets.dataLoader = new ZipLoader();

When that's done, you use your AssetManager just like before, both for zipped and unzipped files.


Happy zipping!


  • 2018/04/18: First public version.
  • 2018/06/04: Moved all the code into the DataLoader extension.

Source Code


User Comments

Feel free to edit this part of the page if you want to add information that's lacking in the above description.
Questions are better asked in the forum, though.

  extensions/zipped-assets.txt · Last modified: 2018/06/04 14:41 by daniel
Powered by DokuWiki