/sh/saqoo/util/FrameDelay.as
http://github.com/Saqoosha/SAQAS3 · ActionScript · 26 lines · 20 code · 6 blank · 0 comment · 4 complexity · d394285f8e9f0f503bc84d43f34a0eb0 MD5 · raw file
- package sh.saqoo.util {
- import flash.events.Event;
- public class FrameDelay {
- public function FrameDelay() {
- throw new Error('Cannot create FrameDelay instance.');
- }
- public static function set(numFrames:uint, callback:Function):void {
- if (numFrames == 0) {
- callback();
- } else {
- EnterFrameBeacon.add(function(event:Event):void {
- if (--numFrames <= 0) {
- EnterFrameBeacon.remove(arguments.callee);
- callback();
- }
- });
- }
- }
- }
- }