You won't want to hear this, but folks will be telling you: "on the
server"

 

That is about the only way to get asynchronous behavior.  I have been
tempted to try to do something tricky using timer and mouse keyboard
events to sneak processing in between user actions, but have never done
it.

 

I have also thought about starting another instance of the Flash player
to handle heavy processing, but I think they would both run in the same
VM, so that wouldn't work either.  Again, I haven't done anything more
than think about it.

 

People have been begging for some kind of threading for  a long time,
but the Flash Player team seems pretty adamant that this won't happen
any time soon.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of danielggold
Sent: Friday, November 09, 2007 5: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