Its well known that the current versions of Flex (using either the flash or AIR players) do not provide support for multithreading. Everything you do is loaded on the same main thread that is running the GUI too.
This restriction means that if you have to do a dutiful task, the GUI actually stops responding to the user and your app may even get the “Not Responding” label in the title bar while its off processing.
The way to bypass this issue is to follow two guidelines
- Break down the big process in to smaller, manageable runs. this means that if you have a loop that each iteration is taxing, you would want to call that loop one iteration at a time.
- Call the single iteration in a way that interlaces with the GUI refresh rate.
Here is a simple GUI component that you may place on your application, to invoke calls on some other process without hampering the responsiveness of the GUI.
The method you call by this component has to be in the nature of:public function runFunction(data:Object):Boolean
Download zip file for AsyncThreadComponent
Paste this on your app:
<view:AsyncThreadComponent id="asyncThread" />
When you want something to be invoked, create an object and pass the method:asyncThread.exec(theObject.runFunction,theObject);
Independent on Sundays