Title: Message

Well, make sure after you call doLater you actually exit right?  You can’t write a recursive function that simply calls doLater, it has to actually make sure the recursion exits completely occasionally.  Gordon’s description is right on, use something that is keeping track of where you are (depending on complexity it could be a stack of these objects).  Then you basically do work, store state, doLater, return.  When you re-enter you restore state, do more work, store state, doLater, return.  Rinse, repeat.

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt
Sent: Wednesday, May 04, 2005 6:56 PM
To: [email protected]
Subject: RE: [flexcoders] Force UI update during intense AS work: doLater, maybe?

 

Thanks, yes, I do get the idea.  I would have though that putting the doLater on my recursive call would have done the trick.  I’ll try again, maybe I just gave up too soon.

 

Tracy

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Gordon Smith
Sent: Wednesday, May 04, 2005 9:02 PM
To: '[email protected]'
Subject: RE: [flexcoders] Force UI update during intense AS work: doLater, maybe?

 

The Flash player won't update the screen while one of your methods is executing. You'll have to break your work up into chunks which can execute over a sequence of frames. A typical way to do this is:

 

1. Define an object which will keep track of how far your work has progressed. For example, it might store that you have processed 50 tree nodes.

 

2. Write a method which will incrementally do more work. For example, it might 10 more tree nodes starting from where you left off the last time it was invoked.

 

3. Have this method doLater() itself if it doesn't finish the job.

 

I'm sorry thatI don't have any code to share that illustrates this technique, but I hope you get the idea.

 

- Gordon

 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 04, 2005 5:06 PM
To: [email protected]
Subject: [flexcoders] Force UI update during intense AS work: doLater, maybe?

One part of our app does VERY intense work, building a tree, an inverted tree (thousands of nodes), and several arrays.  Even though I have a progress bar, and update it and its label throughout the various function calls, those updates never appear on the screen, until that particular processing ends and we go to get more data.

I have fiddled with using doLater between the recursive function calls, but did not have any success forcing the screen to repaint.

Is doLater the right idea?  Do I put my screen update code before the doLater? After? How can I tell the processing to take a breath and let the UI render?

Tracy

 



Yahoo! Groups Links

Reply via email to