chapter9 Controls

来源:互联网 发布:java自定义异常类 编辑:程序博客网 时间:2024/04/26 08:17

=========================之 Progress Bar P318==================================

【Progress Bar】
The ProgressBar control provides a visual representation of the progress of a task over time。

two types:
A determinate ProgressBar: 任务的范围是可知的。
An indeterminate ProgressBar control:represents time-based processes for which the scope is not yet known。以时间为准,任务的范围是不可知的。

【ProgressBar control modes】 模式
你可以使用mode属性来指定ProgressBar的操作模式,支持以下3种模式:
event: Use the source property to specify a loading process that emits progress and complete events. For Example, the SWFLoader and Image controls emit these events as part of loading a file. You typically use a determinate ProgressBar in this mode. The ProgressBar control only updates if the value of the source property extends the EventDispatcher class. This is the default mode. You also use this mode if you want to measure progress on multiple loads; for example, if you reload an image, or use the SWFLoader and Image controls to load multiple images.
polled: Use the source property to specify a loading process that exposes the bytesLoaded and bytesTotal properties. For example, the SWFLoader and Image controls expose these properties. You typically use a determinate ProgressBar in this mode.
manual: Set the maximum, minimum, and indeterminate properties along with calls to the setProgress() method. You typically use an indeterminate ProgressBar in this mode.

其中 source 属性非常重要。

三种模式的例子:
event:在这种模式下,Image控件会发送progress event在加载期间,发布complete event在加载结束。这是默认模式,适合于 determinate ProgressBar
polled:这种模式下,<mx:Image> 指定了 bytesLoaded 和 bytesTotal属性。适合于 determinate ProgressBar
manual:这种模式下,需要使用 maximum、minimum属性 和 setProgress(Number completed, Number total) 方法。适合于 indeterminate Progressbar

【Defining the label of a ProgressBar control】
You use the label property to specify a different text string to display