Preloader , now that NMEPreloader is depreciated

BitmapData.fromBytes won’t work on HTML5 – at least, not instantly. If you do not rely upon bitmapData.width or bitmapData.height, I believe it should work once the image is loaded.

Otherwise, it is important to call loadFromBytes instead to wait asynchronously. I believe the @:bitmap embed adds an “onload” callback parameter as the final argument in the constructor on the HTML5 target, but I’d like to think of a better system long-term

Oh, I almost forgot :slight_smile:

In XML:

<asset path="Assets/preloader" library="preloader" />
<library name="preloader" embed="true" />

Then I believe that should embed the files under “preloader” as it’s own asset library, which you can load inside of your preloader:

Assets.loadLibrary ("preloader").onComplete (function (_) {
    var bitmapData = Assets.getBitmapData ("preloader:image.png");
    ...
});

That’s an alternative to @:bitmap