zoukankan      html  css  js  c++  java
  • 只用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>

  • 相关阅读:
    字符流与字节流的区别
    向文件尾部追加内容
    Hashmap实现原理及扩容机制详解
    HashMap的put和get方法原理
    关于数字化工厂&智能工厂建设 IT 经验总结
    @所有人,网易数字+大会报名通道正式开启!
    WinForm程序打包1之快速入门
    解决安装.NET Framework不受信任的根证书
    Cannot resolve com.sun:tools:1.8.0 错误解决
    IDEA 2020报“java:程序包XXXX不存在”或“java:找不到符号”
  • 原文地址:https://www.cnblogs.com/tsg0723/p/2642470.html
Copyright © 2011-2022 走看看