Hi, I'm looking at the following simple example:
http://blog.flexexamples.com/2007/10/31/pausing-the-animation-in-an-indeterminate-progressbar-control/
That shows how the animation on the indeterminate property of
ProgressBar is only animated when the mode is set to "event". It woks
on the live demo on that page, but I can't seem to get it to work for
me.
<mx:ProgressBar
width="100%"
id="progressBar"
indeterminate="false"
indeterminateMoveInterval="50"
minimum="0"
maximum="100"
visible="true"
mode="event"
source="{fileRef}"
labelPlacement="center"/>
The progress bar is meant to show the progress of a file upload.
{fileRef} is a FileReference I get from having the user browse. This
all works great. The file is uploaded, and the progress bar shows the
status updates. Below are the two functions related to this. So,
when the user clicks the Upload button, I set indeterminate to true,
and it shows me the indeterminate style, but there is no animation.
When a ProgressEvent.PROGRESS is fired, I switch off indeterminate and
see the progress bar show status updates as the file uploads.
My question is why don't I see the indeterminate animation? The mode
is clearly set to be "event". Any ideas? Thanks in advance -- davis
/**
* Handler when upload button is clicked
*/
private function upload():void {
// set to indeterminate
progressBar.indeterminate = true;
// add form params to our post
var params:URLVariables = new URLVariables();
params.description = descriptionText.text;
params.applicationId = urlText.text;
params.indexFile = indexFileText.text;
urlRequest.data = params;
// add event listeners
fileRef.addEventListener(Event.COMPLETE, onUploadComplete);
fileRef.addEventListener(ProgressEvent.PROGRESS, onProgress);
// disable upload button so they can't upload while in progress
uploadBtn.enabled = false;
// do upload
fileRef.upload(urlRequest);
}
/**
* Need to trap on this to turn off progress bar indeterminate
*/
private function onProgress(e:ProgressEvent):void {
if(progressBar.indeterminate) {
trace("setting indeterminate to false");
progressBar.indeterminate = false;
}
}