[HTML5] Assets.loadBitmapData > lime Future.onProgress event not firing

Hi there,

I’m trying to load pictures with Assets.loadBitmapData and displaying the loading state with a preloader, but running into troubles with the callbacks.
I’m using simple code :

Assets.loadBitmapData(picturePath).onProgress(_onUpdate).onComplete(_onPictureLoaded);

private function _onUpdate(percent:Float):Void {
	trace("UPDATE");
}

private function _onPictureLoaded(bmp:BitmapData):Void {
	trace("LOADED");
}

The onComplete goes through without any problem (get my LOADED trace) but the onProgress is never fired…?

Any idea?

I forget, but there might not be progress available for these kinds of HTML5 requests (or we just need to wire something up?)

That would explain why it doesn’t work ^^
I guess that’s only for the Assets.loadBitmapData ? The progress events are available in HTML5 for Loader or URLLoader…?
I’m gonna try that right now.

Hmm, looking at the following:

the browser doesn’t know how many bytes will send the server request. The only thing that browser knows in this case is the size of bytes it’s receiving

We could consider hard-coding the size of assets in the asset manifest to try and hack this, but it seems most browsers won’t tell us how far along we in general :frowning:

Those answers actually seem old, perhaps this would work?

Ahahah I’ve been so used to Flash environment that I forgot working in a browser is completely different… :grin:
Gonna have a look at the XMLHttpRequest, but indeed hardcoding the size in the manifest would be a good workaround here…
Thanks!