Flex & Flash: Refreshing Screen During Processor Intensive Operations

I did this to help illustrate to a homey on the Flexcoders list how you update the screen during intense operations. As was suggested by multiple Macromedians, you should have a counter keep track of where you are in the data processing, and only process a set chunk amount, update the screen, and continue processing.

You can accomplish this through a series of doLaters. They are not perfect because they don’t ensure the same method isn’t called more than once per frame unecessarely, but trying to explain to a Java developer what:

functon onEnterFrame()
{
callMethod();
delete onEnterFrame;
}

…does really isn’t worth it.

Anyway, here’s a good example any Flexer or Flasher can use to see how to update your GUI with a ProgressBar for example when you have a very processor intensive loop going on in the background.

Update GUI While Processing

One Reply to “Flex & Flash: Refreshing Screen During Processor Intensive Operations”

  1. Thanks for the example. I haven’t seen too many examples of using doLater() out there. I actually have this same exact problem with a GUI I’m working on right now (loading and parsing a ton of XML in a loop). Not sure I will use a progress bar, but this example really helps.

Comments are closed.