Asynchronous bitmap decoding in the Adobe Flash runtimes

I just wanted to show you one little improvement we added in Adobe AIR 2.6 (also coming in a future release of the Adobe Flash Player) to improve responsiveness of your applications. For many years when loading big images, your UI could be impacted during the image decoding. As the decoding could be intensive and done on the UI thread, it would generally lock your application and impact the overall responsiveness and make your animations not smooth. We now decode images in a separate thread.

Here is how you would specify this in ActionScript 3 :

// create a LoaderContext
var loaderContext:LoaderContext = new LoaderContext();
// specify async decoding
loaderContext.imageDecodingPolicy = ImageDecodingPolicy.ON_LOAD;
// create a Loader
var loader:Loader = new Loader();
// inform the Loader
loader.load( new URLRequest("http://dl.dropbox.com/u/7009356/IMG_1398.jpg"), loaderContext );

Note that this feature also work with the Loader.loadBytes() API. Find below a little demo of the value of this new feature that we are also bringing to the Flash Player. I am playing a little animation and loading a big image in the background. Note how the animation is locked for a few ms when not using the async decoding :

While we are working more generally on the concurrency topic, we are also working at the same time on other little improvements like this, to keep improving the responsiveness of your application with very little effort.

As always, thanks Chris for the beautiful asset ;)

Show Comments

Hide Comments

Comments are closed.