I haven’t had a lot of luck with this approach in the past.  Even though you are telling it to update at that moment, it doesn’t mean the flash player will redraw at exactly that time.  The player waits until it has enough resources to perform the redraw action.  If your process is hogging all of the cpu cycles, then it is not going to redraw.  I have successfully achieved this type of functionality by changing how I processed my data.  Instead of looping over a large dataset, I used a timer to call a function every millisecond.  In that function, I perform whatever action is necessary on one item.  Then process the next data item in the next timer event.  This gives the player a “break” in between function calls, where it has the resources to update the screen.  The code is more complex and performs slightly slower than just looping over the data, but it also prevents any errors where the player times out the function b/c the function is taking too long to execute. 

 

This *might* help you, but I make no guarantees.  It depends what your function does, and how you are processing your data.  This option may not even be feasible for you.

 

-Andy

 

_____________________________________

Andrew Trice

Cynergy Systems, Inc.

http://www.cynergysystems.com

 

Blog: http://www.cynergysystems.com/blogs/page/andrewtrice

Email: [EMAIL PROTECTED]

Office: 866-CYNERGY 

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Freiman
Sent: Monday, October 16, 2006 1:41 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Invalidating a control during a CPU intensive task.

 

There are two issues:

First, the progress bar is listening for your source to send events that progress was made (that's the way bound variables are implemented).  I forget whether events are dispatched immediately, or at the next free moment.  If it's immediately, than this isn't a problem.  Otherwise, you're going to have to update the progress directly.

Second, the Progress bar redraws itself using updateDisplayList().  Whenever the progress (the internal value) is updated in the bar, the bar calls invalidateDisplayList().  Invalidate display list tells updateDisplayList() to run at the next free moment.  In your scenerio, there is no next free moment, so we need to shortcut that wait.  Normally this would be done by extending the progress bar and overriding some functionality, but everything you need to get to is private so we can't do that...sort of.  Something that might work would be to override invalidateDisplayList() and have it call updateDisplayList() intead of doLater(updateDisplayList).  However, this is a bad idea because it might cause an error on initialization and in general isn't great for performance.  However, if the progress bar isn't used much it might work fine for your purposes.  Otherwise you'd need to update the value directly instead of being bound.  You'd want to do that through a function you create (let's call it setProgressNow) that calls setProgress() and then calls updateDisplayList() that sets the progress and then calls updateDisplayList immediately.

Let me know if any of that didn't make sense or won't work for some reason I haven't thought of.

- Dan

On 10/16/06, Steve Kellogg @ Project SOC <[EMAIL PROTECTED]com> wrote:

Thanks for your reply.

 

The value of the progress bar is BOUND to a var.  I also tried updating it directly.  I've also tried replacing the progress bar with a LABEL that just displays text explaining where we're at, but I get the same result.

 

Best regards,

 

Steve

 

 

 


From: [EMAIL PROTECTED]ups.com [mailto: [EMAIL PROTECTED]ups.com] On Behalf Of Daniel Freiman
Sent: Monday, October 16, 2006 8:03 AM
To: [EMAIL PROTECTED]ups.com
Subject: Re: [flexcoders] Invalidating a control during a CPU intensive task.

 

How does the progress bar know how much progress has been made?  Is it bound to something, is it listening for an event, it is being updated directly, etc?

- Dan

On 10/15/06, Steve Kellogg @ Project SOC <[EMAIL PROTECTED]com> wrote:

Hello,

 

I've got a long CPU routine, and I'm using a progress bar to show the user that we're making…. progress..

 

The PROBLEM is that the progress bar doesn't seem to be updating until my long CPU TASK is complete (presumably because I'm not relinquishing the CPU during the routine).

 

Is there anyway to tell Flex/Flash to IMMEDIATELY redraw an element in the UI?

 

 

Thanks in advance for any advice.

 

 

Steve

 

 

 

Steve Kellogg

Peak8 Solutions

1401 14th Street

Boulder, Colorado

80302, USA

Fax: 303.415.2597

E-Mail: [EMAIL PROTECTED]com

 



 

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to