• Flex学习笔记-时间触发器


    <?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"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   minWidth="955" minHeight="600"
                   creationComplete="init()"
                   >
        <s:layout>
            <s:VerticalLayout paddingLeft="20" paddingTop="20"/>
        </s:layout>
            <fx:Script>
                <![CDATA[
                    import flash.utils.Timer;
                    
                    import mx.controls.Alert;
                    
                    import spark.effects.animation.RepeatBehavior;
                    
                    
                    [Bindable]
                    protected var secondsTillDue:int = 10;
                    protected var _timer:Timer;
                    
                    protected function init():void{
                        
                    _timer = new Timer(1000);
                    
                    
                    _timer.addEventListener(TimerEvent.TIMER,onTimerTick);
                    _timer.start();
                    }
                    
                    protected function onTimerTick(event:TimerEvent):void{
                        
                      secondsTillDue = Math.max(secondsTillDue-1,0);
                      if(secondsTillDue == 0)
                      {
                       effect.play();
                      _timer.stop();
                       see.visible =true;
                      
                      }
                    }
                ]]>
            </fx:Script>
        <fx:Declarations>
            <s:GlowFilter id="filter" color="#4e7800" blurX="20" blurY="20"/>
            <s:AnimateFilter id="effect" target="{box}" bitmapFilter="{filter}" duration="1000" repeatCount="0" repeatBehavior="{RepeatBehavior.REVERSE}">
                <s:SimpleMotionPath property="alpha" valueFrom="0" valueTo="1"/>
            </s:AnimateFilter>
                    
        </fx:Declarations>
        <s:Label id="labelField" fontWeight="bold" fontSize="14" text="倒计时{secondsTillDue}秒"/>
        <s:Rect id="box" width="200" height="200">
            <s:fill>
                <s:SolidColor color="black"/>
            </s:fill>
        </s:Rect>
        <s:Label id="see" text="触发了" visible="false"/>
        
    </s:Application> 
    View Code
  • 相关阅读:
    config 文件夹中的 dev.env.js
    config 文件夹中的 index.js
    Dialog 对话框 可拖拽
    Pagination 分页 封装
    ElasticSearch学习03--使用Java连接ES
    ElasticSearch学习02--使用Kibana管理ES
    ElasticSearch学习01--基本结构与操作
    redis学习02--使用Jedis调用Redis
    redis学习01--常用命令
    Java基础学习08--JDK1.8特性
  • 原文地址:https://www.cnblogs.com/zhugexiaobei/p/3242676.html
Copyright © 2020-2023  润新知