Categories

Tag Cloud

Archives

Threading in Flex

Most applications require you, at one time or another, to process something behind the scenes whilst you get on with something else up front. If you’re familiar with Java you will be familiar with the threading model it employs.

Flex, however,  is single-threaded. Or to be more precise the ActionScript 3.0 execution model is single threaded. This can lead to occasions where you see the UI freeze as it attempts to process some CPU intensive computations.

An issue of this is that there is no capability for yielding or blocking in the code. You will have encountered this if you’ve ever tried to debug by using multiple Alert.show() messages in a single function (hint: they all pop-up).

The solution to this, has been to write you’re own code to chop the processing up into manageable chunks and then write some code to manhandle that. Not a nice way to go about things. Luckily someone out there has developed a neater solution.

John Blanco is a RIA developer with quite a few years of Flex/Flash under his belt, his solution to the problem, called Ender’s Lib, can be found here.

RSS Feed Add to Technorati Favorites Add to Del.icio.us Stumble It! Submit to Slashdot Submit to Buzz! Digg It!

10 comments to Threading in Flex