Chinaunix首页 | 论坛 | 博客
  • 博客访问: 92690
  • 博文数量: 41
  • 博客积分: 2650
  • 博客等级: 少校
  • 技术积分: 680
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-23 16:26
文章分类

全部博文(41)

文章存档

2011年(1)

2008年(40)

我的朋友

分类:

2008-06-24 15:54:19


以下的例子展示了当进度条完成(100%)时的一个效果
 

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/03/15/setting-a-complete-effect-on-a-progressbar-control-in-flex/ -->
<mx:Application xmlns:mx=""
        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>

查看Demo演示

阅读(237) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~