Only one thread in flex/flash actionscript.  Asynch i/o is funneled into
that thread on each frame.  If you can, break heavy lifting into
segments per frame or on demand

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of danielggold
Sent: Friday, November 09, 2007 2:49 PM
To: [email protected]
Subject: [flexcoders] Where to do heavy lifting in a Flex app? (no
threading?)

 

I've got a few data processing functions in a Flex app I'm developing
that have to do some heavy lifting and require some time to finish
executing. I'm using cairngorm in this app, and the work is done on
the result handler of the command. I was surprised to see that this
function completely stalled the application until it finished
executing. For some reason since this was done on the result of an
event, I thought it would be executed in some background thread. I
really don't care how long it takes to process, I just want the UI to
be usable while it does its work.

I did some more tinkering and I discovered that event handling in Flex
was not working the way I believed. When I call dispatchEvent in a
function, any functions registered as listeners to this event run to
completion before the next line of code is executed. I thought the
"event flow" in Flex would be handled in a different thread some how
so that dispatchEvent would return to the calling function immediately
and you could go on with your work, all the listeners would be
executed at some later time.

Does anyone have any good insight about where "heavy lifting" should
be done in Flex? If everything happens serially like this it seems
like structuring a fairly large application would be tough to do. You
almost always need a place to do "background work" that is not time
critical.

Any responses are appreciated

 

Reply via email to