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…?
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.
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
Ahahah I’ve been so used to Flash environment that I forgot working in a browser is completely different…
Gonna have a look at the XMLHttpRequest, but indeed hardcoding the size in the manifest would be a good workaround here…
Thanks!