I’m downloading images from web via Loader class, after successful download I’m saving the image to application’s cache. If someone tries to redownload image I load it directly from device instead of web. Again I’m using Loader class. Loading images takes about 400 miliseconds on my phone. However if I use BitmapData.loadFromBytes it takes only ~100 miliseconds…but it’s not asynchronous so my whole app freezes Is there a way to load images faster while still relying on asynchronous methods? I’m using legacy mode.
How would loading image using Thread class look like?
private function loadImage():Void
{
var worker:Thread = Thread.create(function()
{
var main:Thread = Thread.readMessage(true);
bdm = BitmapData.loadFromBytes(ba, null);
onBytesComplete();
});
worker.sendMessage(Thread.current ());
}
This code still freezes my tablet
Update:
I guess I was wrong, this function works fine. On newer devices it works flawlessly. However on galaxy tab 3 image loads fast but there is a huuuge delay after calling addChild(new Bitmap(bdm)).