PDA

View Full Version : ProgressBar not updating no matter what I try


shizny
04-30-2009, 03:52 PM
Hello,

I'm working on a progressBar for the loading of several local files in an AIR app. I am calling an update function out of a loop that runs on every line of a file that has loaded. I can't, for the life of me, get the progressbar to visually update. I've tried just about everything with the progressBar, manual mode, event mode (dispatching my own ProgressEvents, etc.) and nothing will work. I'm running mac os x10.4 and compiling for flash player 9. Anybody have any ideas. Here is a code snippet from where I'm updating the progressbar.

Like I said, I can verify, through breakpoints, that setPercentage is getting called, but no visual result displayed.

<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml">
<!--<mx:Dissolve id="myShow" duration="500" alphaFrom="0.0" alphaTo="1.0"/>-->
<mx:Box>
<mx:Script>
<![CDATA[
import com.widgetmakers.coolwidget.globals.MessageStrings ;

[Bindable] private var progressLabel:String = MessageStrings.EXTRACTING_INVOICE_INFO;

public function setPercentage(thePercentage:Number):void {
var theP:Number = Math.round(thePercentage);
this.bar.setProgress( theP, 100 );
}

]]>
</mx:Script>

<mx:VBox>
<mx:ProgressBar id="bar" labelPlacement="bottom" themeColor="#F20D7A"
minimum="0" visible="true" maximum="100" label="{this.progressLabel}"
direction="right" mode="manual" width="100%"/>
</mx:VBox>
</mx:Box>
</mx:Module>

Raptoer
07-15-2009, 07:30 PM
I know I'm resurrecting a dead thread, but I'm having the exact same problem with no solution in sight. I can invalidate then validate everything and watch it step through the code, it even runs the drawRect() to redraw the rectangle, but it visually does not change.

My code goes like this

Set progressBar to 12% (invalidate and validate everything having to do with the bar)
doWork()
Set progressBar to 56% (numbers are arbitrary)

The progress bar is not visually updating to 12% during the work, it only updates when flash finishes everything and by then the work is all done and progressBar is now at 56%, making the progressBar kinda useless.

I have also tried making the doWork() be called by callLater(doWork) and by setTimeout(doWork) with no success. I might be able to switch to even mode however switching to polled mode is out of the question. Most of the progress bars I can find online are only used when down/up loading a file where polled mode can be used, instead of in my case where I'm waiting on flex calculations or backend (Java server) calculations or loading.

rexdtripod
12-29-2009, 04:03 PM
Yeah, same problem here. This simply doesn't work in ActionScript.

If I do it in Flex using the mx:ProgressBar it works. Just not in ActionScript.

Wish this would be fixed. Need to update my PB in ActionScript.