ActionScript 3 定时器与简历

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 定时器与简历相关的知识,希望对你有一定的参考价值。

package inca.utils {

import flash.utils.Timer;

public class TimerAdv extends Timer {

private var $__initDelay:Number = 0;
private var $__pauseTime:Number = 0;
private var $__acumulado:Number = 0;
private var $__startingTime:Number = NaN;
private var $__paused:Boolean = false;

public function TimerAdv(delay:Number, repeatCount:uint = 0){
$__initDelay = delay;
super(delay, repeatCount);
}

public function get paused():Boolean{ return $__paused; }

override public function start():void{
if($__paused){
resume();
}else{
$__startingTime = new Date().getTime();
super.start();
}
}

override public function reset():void{
delay = $__initDelay;
$__acumulado = 0;
$__pauseTime = 0;
super.reset();
}

public function pause():void{
if(isNaN($__startingTime)) throw new Error("You can't call TimerAdv.pause() without calling TimerAdv.start() first.")
super.stop();
$__paused = true;
$__pauseTime = new Date().getTime();
}

public function resume():void{
$__paused = false;
delay = Math.max(0, ($__initDelay - (($__pauseTime - $__startingTime) + $__acumulado)));
$__acumulado += ($__pauseTime - $__startingTime);
start();
}

}

}

以上是关于ActionScript 3 定时器与简历的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 向后计数计时器

ActionScript 3 计时器

ActionScript 3 AS3:基本计时器示例

ActionScript 3.0计时器事件

ActionScript 3.0 套接字无法重新连接

使用 actionscript 3 自动刷新 swf 电影