HTML5 Preloader

A little inconsistency between platforms.
Here is an example:

var parent:Sprite = Sprite();
var child:Sprite = new Sprite();

... //do some drawings;

So, on flash and native platforms, graphics always goes under any children.
On HTML5 it goes over children.

It is supposed to always be under

1.) Is this a regression since a recent OpenFL release?
2.) Does this occur on the HTML5 WebGL target? (-Dwebgl or default)
3.) Does this occur on the HTML5 canvas renderer (-Dcanvas)
4.) Does this occur on the HTML5 DOM target? (-Ddom)

Oops, my bad! It was broken GlowFilter, graphics works as expected!
But, I’ve found a different problem, Preloader.

  1. With -Dwebgl, I see black screen instead of preloader image (@:bitmap("preload.jpg") class Back extends BitmapData {})
  2. -Dcanvas, there is my image, but not stretched to screen size.
  3. -Ddom, same as 2.


@:bitmap("/preload.jpg") class Back extends BitmapData {}
var bmpd:BitmapData = new Back(0, 0);
var back:Bitmap = new Bitmap(bmpd, PixelSnapping.AUTO, true);
back.width = w;
back.height = h;

The issue is that we still need an asynchronous call to wait for embedded images on HTML5. I believe you can pass an extra callback to the constructor for Back (only on HTML5)

or you may want to consider this solution (I have example code):


Ah, good, thank you!