How to Embed assets in Haxe, like in ActionScript

Sometimes trying to find a simple thing is really hard when you are learning a new language. Something most of us have to do for every project that is writen in Actionscript is to embed assets. 

The Actionscript way


private var MyImageBM:Class;

Here is the Haxe way

@:bitmap(“myimage.png”)class MyImageBM extends BitmapData {}

var bm = new Bitmap(new MyImageBM(100,100));