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.animation.RepeatBehavior;
         
          [Bindable]
          protected var secondsTillDue:int = 5;
          protected var _timer:Timer;
         
          protected function init():void{
            _timer = new Timer(1000); //tick every 1000ms  设置每1000ms运行一次的计时器
            _timer.addEventListener('timer', onTimerTick);
            _timer.start();
          }
         
          protected function onTimerTick(event:TimerEvent):void{
            secondsTillDue = Math.max(secondsTillDue-1, 0);//更新secondsTillDue的值
            if(secondsTillDue == 0){//如果secondsTillDue为0,那么播放效果并停止计时器
              effect.play();
              _timer.stop();
            }
          }
        ]]>
      </fx:Script>
      <fx:Declarations>
        <s:GlowFilter id="filter" color="#de7800" blurX="20" blurY="20" />//设置GlowFilter来发出橘黄色的光
        <s:AnimateFilter id="effect" target="{box}" bitmapFilter="{filter}"//AnimateFilter来播放效果
                         duration="1000" repeatCount="0"
                         repeatBehavior="{RepeatBehavior.REVERSE}">
          <s:SimpleMotionPath property="alpha" valueFrom="0" valueTo="1" />//设置动画路径来创建alpha动画( RepeatBehavior常量REVERSE,LOOP创建往复效果)
        </s:AnimateFilter>
      </fx:Declarations>
      <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>

  • 相关阅读:
    推荐系统入门笔记2--信息检索 Lucene
    Mybatis多个参数,其中有hashMap的写法
    Java中fastjson的toJSONString结果为空{}
    Linux中less命令出现ESC乱码
    关于博客
    【Uni-App】关于获取手机系统信息的项目实践
    mysql 服务列表找不到
    服务网格与Istio
    ARM架构服务器如何运行EasyNVR软件提示无法识别二进制文件排查及解决
    关于EasyNVR拉流摄像头的视频流存在视频流锁定机制的问题说明
  • 原文地址:https://www.cnblogs.com/tsg0723/p/2642422.html
Copyright © 2011-2022 走看看