在Flex中使用进度条(ProgressBar)
2010-08-26 点击:次
以下例子展示Flex中如何使用进度条(ProgressBar)的简单例子
- <?xml version="1.0"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
- <mx:Script>
- <![CDATA[
- private var timer:Timer;
- private var j:uint=10;
- private function init():void {
- timer = new Timer(100);
- timer.addEventListener(TimerEvent.TIMER, runit);
- }
- private function runit(evt:TimerEvent):void
- {
- if(j<=100)
- {
- bar.setProgress(j,100);
- bar.label= "CurrentProgress" + " " + j + "%";
- j+=10;
- }
- if(j>100)
- {
- timer.stop();
- }
- }
- private function startTimer():void {
- timer.start();
- }
- ]]>
- </mx:Script>
- <mx:Panel title="ProgressBar Control Example" height="75%" width="75%"
- paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
- <mx:Label width="100%" color="blue"
- text="Click the button ." />
- <mx:Button id="startBtn" label="Run" click="startTimer();"/>
- <mx:ProgressBar id="bar" labelPlacement="bottom" themeColor="#00FF00"
- minimum="0" visible="true" maximum="100" label="CurrentProgress 0%"
- direction="right" mode="manual" width="100%"/>
- </mx:Panel>
- </mx:Application>
所属分类:技术经验分享
本文标签:进度条 flex ProgressBar




