Hi all, thanks for making OpenFL great.
I have a little problem I can’t seem to solve using the lime.system.BackgroundWorker.
I’m compiling to HTML5 and I am able to query and load dynamic image resources from the host domain without any issues.
But, when I use a background worker to decode the loaded data I get a huge delay and massive drops in frame rate. It seems that the background worker is running on the browsers main thread.
var worker: BackgroundWorker = new BackgroundWorker();
worker.doWork.add(function(_) {
log.info("Start - texture decode");
var bitmapData: BitmapData = BitmapData.fromBytes(loader.data);
log.info("End - texture decode");
worker.sendComplete();
});
worker.onComplete.add(function(_) { ... });
worker.run();
This is the offending chunk of code, I’ve enabled timestamps on my console window and can confirm that the huge delays are right between the 2 log lines I added. I do repeat this for ~40 - 50 times and I wait until each image is fully loaded and ready before starting the request to load the next image.
I tried looking through the docs for the BackgroundWorker, but they are sparse, and seem to indicate that it should work for the html5 target.
Any ideas or suggestions would be most welcome.
Thank you