1 Reply Latest reply on Apr 21, 2009 7:17 PM by atta707

    for each in loop not updating the progress bar until loop is finished

    flashharry!

      This is an AIR app in flex3 on OSX 10.4.

       

      I have a loop that is running through an XML object.

       

      In my example there are more than 3000 children, could be more once distributed.

       

      While I'm processing the XML, I want to show a progress bar to the user.

       

      But the progress bar does not update until the loop is finished, the trace prints in the flex builder console as the loop runs.

       

      Once the loop as finished the progress bar updates (too late of course)

       

      I have tried importProgress.validateNow(); but no luck

       

      how can I get a progress bar update each loop.

       

      TIA

      flashharry

       

      var trackLength:Number = xml.children().length();

      var trackCount:Number = 0;

      for each(var d:XML in xml) {

           trackCount ++;

           trace(trackCount);

           importProgress.setProgress(trackCount, trackLength);

      //do something

       

      }