Is it possible to show the progress of a code loop on a progress bar?
For example, if I have a progress bar named "pbar" already defined on
the stage, and I execute the following function:

 

private function init():void

{

      var total:int = 100000;

      for (var i:int = 0; i < total; i++)

      {

            pbar.setProgress(i, total);

            stage.invalidate();

      }

}

 

The progress bar jumps from 0% to 100% after a long pause (the for loop
executing). I am pretty sure this happens because the entire code loop
executes before the next frame gets rendered. As you can see I even
tried stage.invalidate(), but my guess is that it just tells the stage
to update on the next frame, instead of forcing the stage to update at
that exact time.

 

Is there any way to get this to work in AS3? In other words, is there
any way to force the screen to update in the middle of a code thread?

 

Thanks!

 

-Mac Angell

 

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to