[flexcoders] How to update UI during long operations
I've got a long operation that is updating the UI through data binding, but the UI doesn't update until the operation finishes. How can I relinquish enough control to the UI to update during long operations? Thanks, Robert
RE: [flexcoders] How to update UI during long operations
You need to break the operation up into parts which is fairly straight forward if you process is/has a loop. Create an iterator function that processes a set number of items in the loop, starting from the value you keep in an instance variable. At the end of that function, update the instance variable with the ending index, then use callLater() to call another function. Have that function do any screen updates then call the iterator again if the index flag is less than the length of the loop. callLater() will let the UI update. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Robert Stehwien Sent: Thursday, September 06, 2007 1:32 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] How to update UI during long operations I've got a long operation that is updating the UI through data binding, but the UI doesn't update until the operation finishes. How can I relinquish enough control to the UI to update during long operations? Thanks, Robert
Re: [flexcoders] How to update UI during long operations
Thanks. I was afraid of that. Right now I'm using recursion for the solution. I can refactor my code so the recursive state is saved and control is returned to the UI. --Robert On 9/6/07, Tracy Spratt [EMAIL PROTECTED] wrote: You need to break the operation up into parts which is fairly straight forward if you process is/has a loop. Create an iterator function that processes a set number of items in the loop, starting from the value you keep in an instance variable. At the end of that function, update the instance variable with the ending index, then use callLater() to call another function. Have that function do any screen updates then call the iterator again if the index flag is less than the length of the loop. callLater() will let the UI update. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Robert Stehwien *Sent:* Thursday, September 06, 2007 1:32 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] How to update UI during long operations I've got a long operation that is updating the UI through data binding, but the UI doesn't update until the operation finishes. How can I relinquish enough control to the UI to update during long operations? Thanks, Robert