• 只用ActionScript实现效果


    <?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"
                   applicationComplete="init()">
      <s:layout>
        <s:VerticalLayout paddingLeft="20" paddingTop="20" />
      </s:layout>
      <fx:Script>
        <![CDATA[
          import flash.utils.Timer;
         
          import spark.effects.AnimateFilter;
          import spark.effects.animation.MotionPath;
          import spark.effects.animation.RepeatBehavior;
          import spark.effects.animation.SimpleMotionPath;
          import spark.filters.GlowFilter;
         
          [Bindable]
          protected var secondsTillDue:int = 5;
          protected var _timer:Timer;
          protected var _effect:AnimateFilter;
         
          protected function init():void{
            var filter:GlowFilter = new GlowFilter(0xde7800, 1, 20, 20);//设置GlowFilter来发出橘黄色的光
            _effect = new AnimateFilter(box, filter);//创建效果实例
            _effect.duration = 1000;
            _effect.repeatCount = 0;
            _effect.repeatBehavior = RepeatBehavior.REVERSE;
            _effect.motionPaths = new <MotionPath>[
                                      new SimpleMotionPath("alpha", 0, 1)];//建立alpha动画的MotionPath
           
            _timer = new Timer(1000); //tick every 1000ms 
            _timer.addEventListener('timer', onTimerTick);
            _timer.start();
          }//将计时器设为每1000ms运行1次
          
          protected function onTimerTick(event:TimerEvent):void{
            secondsTillDue = Math.max(secondsTillDue-1, 0);//更新secondsTillDue的值
            if(secondsTillDue == 0){
              _effect.play();
              _timer.stop();
            }
          }
        ]]>
      </fx:Script>
      <s:Label id="labelField" fontWeight="bold" fontSize="14"
               text="Due in {secondsTillDue} seconds" />
      <s:Rect id="box" width="200" height="200">
        <s:fill>
          <s:SolidColor color="black" />
        </s:fill>
      </s:Rect>
    </s:Application>

  • 相关阅读:
    论线段树:二
    BST 二叉搜索树
    论线段树:一
    [luoguP3627][APIO2009]抢掠计划
    二分图匹配(匈牙利算法)
    SPFA 全面讲解
    markdown的常用高级操作。
    UVA11235 Frequent values
    P2279 [HNOI2003]消防局的设立
    P2216 [HAOI2007]理想的正方形
  • 原文地址:https://www.cnblogs.com/tsg0723/p/2642470.html
Copyright © 2020-2023  润新知