Egret 定时器

//定时器demo
module game{
    export class TimerDemo extends egret.DisplayObjectContainer{
        private count : number = 0;
        public constructor(){
            super();
            var timer:egret.Timer = new egret.Timer(1000,5);
            timer.addEventListener(egret.TimerEvent.TIMER,this.timerFunc,this);
            timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE,this.timerComFunc,this);
            timer.start();
        }
        private timerFunc(): void{
            this.count += 1;
            console.log("计时: " + this.count);
        }
        private timerComFunc(){
            console.log("计时结束");
        }
    }
}

 

你可能感兴趣的:(Egret)