Flex-progressbar-control

提供:Dev Guides
移動先:案内検索

Flex-ProgressBarコントロール

前書き

ProgressBarコントロールは、時間の経過に伴うタスクの進行状況を視覚的に表現します。

クラス宣言

以下は mx.controls.ProgressBar クラスの宣言です-

public class ProgressBar
   extends UIComponent
      implements IFontContextComponent

パブリックプロパティ

Sr.No Property & Description
1

alignToolTip : String = "Align"

ユーザーがテキスト配置ボタンにカーソルを合わせたときに表示されるツールヒント。

2

conversion : Number

現在のロードされた着信バイト値とロードされたバイト合計値の変換に使用される数値

3

direction : String

ProgressBarの塗りつぶしが完了に向かって拡大する方向。

4

indeterminate : Boolean

ProgressBarコントロールの外観が確定的か不確定か。

5

label : String

進行状況バーに付随するテキスト。

6 *labelPlacement : String *
7
  • maximum : Number*

ProgressBarの最大進捗値。

8

minimum : Number

ProgressBarの最小の進捗値。

9

mode : String

バーの更新に使用する方法を指定します。

10

percentComplete : Number

[read-only] Percentage of process that is completed.The range is 0 to 100.

11

source : Object

ProgressBarが進行状況を測定しているコントロールを指します。

12

value : Number

[read-only] Read-only property that contains the amount of progress that has been made - between the minimum and maximum values.

パブリックメソッド

Sr.No Method & Description
1

ProgressBar()

コンストラクタ。

2

setProgress(value:Number, total:Number):void

手動モードの使用時に行われた進行量を反映するようにバーの状態を設定します。

イベント

Sr.No Event & Description
1

complete

ロードが完了すると送出されます。

2

hide

オブジェクトの状態が可視から不可視に変化したときに送出されます。

3

progress

コンテンツがイベントモードまたはポーリングモードで読み込まれると送出されます。

4

show

コンポーネントが表示されると送出されます。

継承されるメソッド

このクラスは、次のクラスからメソッドを継承します-

  • mx.core.UIComponent
  • mx.core.FlexSprite
  • flash.display.Sprite
  • flash.display.DisplayObjectContainer
  • flash.display.InteractiveObject
  • flash.display.DisplayObject
  • flash.events.EventDispatcher
  • 対象

Flex ProgressBarコントロールの例

次の手順に従って、テストアプリケーションを作成して、FlexアプリケーションでProgressBarコントロールの使用状況を確認します。

Step Description
1 Create a project with a name HelloWorld under a package com.finddevguides.client as explained in the Flex - Create Application chapter.
2 Modify HelloWorld.mxml as explained below. Keep rest of the files unchanged.
3 Compile and run the application to make sure business logic is working as per the requirements.

以下は、変更されたmxmlファイル src/com.finddevguides/HelloWorld.mxml の内容です。

<?xml version = "1.0" encoding = "utf-8"?>
<s:Application xmlns:fx = "http://ns.adobe.com/mxml/2009"
   xmlns:s = "library://ns.adobe.com/flex/spark"
   xmlns:mx = "library://ns.adobe.com/flex/mx"
   width = "100%" height = "100%" minWidth = "500" minHeight = "500">

   <fx:Style source = "/com/finddevguides/client/Style.css"/>
   <fx:Script>
      <![CDATA[
         private var increment:uint = 10;

         private function runProgressBar():void {
            if(increment < =  100) {
               progressBar.setProgress(increment,100);
               progressBar.label =  "Current Progress" + " " + increment + "%";
               increment+ = 10;
            }

            if(increment > 100) {
               increment = 0;
            }
         }
      ]]>
   </fx:Script>

   <s:BorderContainer width = "630" height = "480" id = "mainContainer"
      styleName = "container">
      <s:VGroup width = "100%" height = "100%" gap = "50"
         horizontalAlign = "center" verticalAlign = "middle">
         <s:Label id = "lblHeader" text = "Complex Controls Demonstration"
            fontSize = "40" color = "0x777777" styleName = "heading"/>

         <s:Panel id = "progressBarPanel" title = "Using ProgressBar"
            width = "500" height = "300">
            <s:layout>
               <s:VerticalLayout  gap = "10" verticalAlign = "middle"
                  horizontalAlign = "center"/>
            </s:layout>

            <s:Label color = "0x323232"
               text = "Click the button to start the progress bar."/>
            <s:Button id = "btnStart" label = "Start"
               click = "runProgressBar();"/>

            <mx:ProgressBar id = "progressBar"
               labelPlacement = "bottom" minimum = "0"
               visible = "true" maximum = "100"
               color = "0x323232" label = "CurrentProgress 0%"
               direction = "right" mode = "manual" width = "90%"/>
         </s:Panel>
      </s:VGroup>
   </s:BorderContainer>
</s:Application>

すべての変更が完了したら、link:/flex/flex_create_application [Flex-アプリケーションの作成]の章で行ったように、アプリケーションを通常モードでコンパイルして実行します。 アプリケーションに問題がなければ、次の結果が生成されます。[link:/flex/samples/ComplexControlsApplicationl#currentlyLoaded = ProgressBar [Try it online]]

Flex ProgressBar Control