加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex 加载进度条

发布时间:2020-12-15 01:07:36 所属栏目:百科 来源:网络整理
导读:?xml version="1.0" encoding="utf-8"?mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" mx:Script ![CDATA[ private var timer:Timer; private function init():void { timer
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
  
  <mx:Script>
    <![CDATA[
      private var timer:Timer;
      
      private function init():void {
        timer = new Timer(10);
        timer.addEventListener(TimerEvent.TIMER,timer_timer);
      }
      
      private function timer_timer(evt:TimerEvent):void {
        progressBar.setProgress(progressBar.value + 1,100);
      }
      
      private function progressBar_complete(evt:Event):void {
        timer.stop();
      }
      
      private function resetProgressBar():void {
        progressBar.setProgress(0,100);
        progressBar.scaleX = 1.0; // 100%
        progressBar.scaleY = 1.0; // 100%
        progressBar.alpha = 1.0; // 100%
      }
      
      private function playProgressBar():void {
        resetProgressBar();
        timer.start();
      }
    ]]>
  </mx:Script>
  
  <mx:Parallel id="progressBar_completeEffect">
    <mx:Fade alphaTo="0.0" />
    <mx:Zoom zoomHeightTo="0" />
  </mx:Parallel>
  
  <mx:ApplicationControlBar dock="true">
    
    <mx:Button label="Play"
             click="playProgressBar();" />
    
    <mx:Button label="Reset"
             click="resetProgressBar();" />
    
  </mx:ApplicationControlBar>
  <mx:ProgressBar id="progressBar"
          complete="progressBar_complete(event);"
          completeEffect="{progressBar_completeEffect}"
          mode="manual"
          labelPlacement="center"
          width="80%"
          height="60%"
          creationComplete="init();" />
  
</mx:Application>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读