ProgressBar between OS X and Windows when the mode = ProgressBarMode.MANUAL and indeterminate = true.To illustrate this, we'll start with the following MXML component:
<mx:progressbar x="10" y="10" id="progress" labelplacement="bottom" indeterminate="true" enabled="true" minimum="0" maximum="100" label="" width="210"/>
With some styling applied, the result is this:

Now, let's say that we want to use the
ProgressBar for some non-indeterminate (er, determinate) purpose, like loading some data from a server. So, let's do this:
progress.indeterminate = false;
progress.mode = ProgressBarMode.MANUAL;
progress.setProgress(0,100);
someLoader.addEventListener(ProgressEvent.PROGRESS,someProgressListener);
Great. Now,
someLoader will load something, and someProgressListener will keep us up-to-date about the progress. So, say we've loaded all the data and now we're doing some processing, the progress of which we don't know since our processing function is synchronous and does not dispatch ProgressEvents. So, we want to set indeterminate back to true so that our users will know something is still happening but not show possibly incorrect progress with a determinate ProgressBar. So, let's do this:
progress.removeEventListener(ProgressEvent.PROGRESS,someProgressListener);
progress.indeterminate = true;
WTF! Now our
ProgressBar looks like this:
In Firefox and IE on Windows, the
ProgressBar looks identical to before, which is the expected behavior. But in Safari (at least) on OS X, we have this monstrosity. What happened? Shouldn't Flash look identical in any browser? Well, apparently it doesn't.Fortunately, this isn't unfixable. In fact, it's a very simple fix, though it makes zero sense to me why this changes the visual display. Just set
progress.mode = ProgressBarMode.EVENT. Turns out that this ugly displacement only occurs in OS X if (progress.mode == ProgressBarMode.MANUAL && progress.indeterminate). Oh well, something to chalk up on the list of cross-browser differences in Flash.On another note, remember that
progress.setProgress(num,total) will not do anything unless you have set progress.mode = ProgressBarMode.MANUAL. This is another thing I think is ridiculous, but the ProgressBar will ignore any calls to setProgress if mode != ProgressBarMode.MANUAL. I understand that the different ProgressBarMode settings will instruct the ProgressBar where to expect progress changes from, but it still seems odd to fully ignore calls to setProgress WITHOUT throwing any kind of error or warning when mode != ProgressBarMode.MANUAL.Versions: This was discovered in OS X 10.5, Flash MAC 10.0.12.36 (debug), Safari 3.2.1.

0 comments:
Post a Comment