[deprecated] Haxelib utility for embed assets.
Latest commit 5341a06 Jul 5, 2014 @tiagolr Update README.md
Failed to load latest commit information.
src/embed/assets Embed assets 1.0 Aug 12, 2012
.gitattributes First commit - preparing repository Aug 12, 2012
.gitignore Embed assets 1.0 Aug 12, 2012
README.md Update README.md Jul 5, 2014



Can be used as old macro reference tho


EmbedAssets is an haxe nme tool that allows you to store external assets inside the binaries at compile-time using macros, and retreive them at run-time.

Suported asset types:

Files of any type can be embed in the compiled code. They can be retreived as:

  • BitmapData - using "IMAGE" as serialize() argument. (use this for png, jpeg or gif).
  • String - using "TEXT" as serialize() argument. (use this for anyfile you want to retreive as a string).
  • ByteArray - using "BYTES" as type argument for serialize method. (use this for anything else).

Usage example:

// Assets serialization 

private function init() {
    EmbedAssets.serialize("images/test.png", "IMAGE", "ImgFirst");
    EmbedAssets.serialize("images/this.png", "IMAGE", "ImgSecond");
    EmbedAssets.serialize("images/oOoO.png", "IMAGE", "ImgThird");
    EmbedAssets.serialize("images/readme.txt", "TEXT", "TxtReadme");
    EmbedAssets.serialize("images/config.xml", "TEXT", "TxtConfig");
    EmbedAssets.serialize("images/flashr.swf", "BYTES", "BTEmbedSwf");
    Lib.stage.addEventListener("ASSETS_LOADED", onAssetsLoaded);

private function onAssetsLoaded(e:Event):Void 
    addChild(new Bitmap(Resources.getBitmapData("ImgFirst")));
    addChild(new Bitmap(Resources.getBitmapData("ImgSecond")));
    addChild(new Bitmap(Resources.getBitmapData("ImgThird")));


    var swf:ByteArray = Resources.get("BTEmbedSwf");

  • Files are stored at compile-time using EmbedAssets.serialize() method.
  • Files can be retreived from Resources class using getBitmapData(), getText() or getBytes() method (like mne.Assets).
  • More information one the arguments are availibe in the sc.


  • For now there is no support for Sound or Font types, let me know if you figure how they can be created from bytearrays.