xiangpei001
Flash/Flex构架师 / 广东
积分 0

在Flex中使用进度条(ProgressBar)


2010-08-26 点击:


以下例子展示Flex中如何使用进度条(ProgressBar)的简单例子
 

  1. <?xml version="1.0"?>    
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">    
  3.     
  4.     <mx:Script>    
  5.         <![CDATA[    
  6.           private var timer:Timer;  
  7.       
  8.           private var j:uint=10;    
  9.               
  10.           private function init():void {   
  11.                 timer = new Timer(100);   
  12.                 timer.addEventListener(TimerEvent.TIMER, runit);   
  13.             }   
  14.  
  15.           private function runit(evt:TimerEvent):void    
  16.           {    
  17.               if(j<=100)    
  18.               {    
  19.                  bar.setProgress(j,100);    
  20.                  bar.label= "CurrentProgress" + " " + j + "%";    
  21.                  j+=10;    
  22.               }    
  23.               if(j>100)    
  24.               {    
  25.                  timer.stop();  
  26.               }    
  27.           }    
  28.             
  29.           private function startTimer():void {  
  30.               timer.start();   
  31.           }  
  32.             
  33.         ]]>         
  34.     </mx:Script>    
  35.     
  36.     <mx:Panel title="ProgressBar Control Example" height="75%" width="75%"      
  37.         paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">    
  38.     
  39.         <mx:Label width="100%" color="blue"    
  40.             text="Click the button ." />    
  41.         <mx:Button id="startBtn" label="Run" click="startTimer();"/>    
  42.                  
  43.         <mx:ProgressBar id="bar" labelPlacement="bottom" themeColor="#00FF00"    
  44.             minimum="0" visible="true" maximum="100" label="CurrentProgress 0%"      
  45.             direction="right" mode="manual" width="100%"/>    
  46.     
  47.     </mx:Panel>    
  48. </mx:Application>           

 


    xiangpei001  版权所有
    禁止任何用途(禁止转载、商用和个人使用)


所属分类:技术经验分享

本文标签:进度条 flex ProgressBar

各位正在潜水的同学请注意,有0位无聊人士 在EBIBI附近出没!







    点击我更换图片 看不清
    评论内容 (*必填):

    (Ctrl + Enter 快速提交)