PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/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
  1. package sh.saqoo.util {
  2. import flash.events.Event;
  3. public class FrameDelay {
  4. public function FrameDelay() {
  5. throw new Error('Cannot create FrameDelay instance.');
  6. }
  7. public static function set(numFrames:uint, callback:Function):void {
  8. if (numFrames == 0) {
  9. callback();
  10. } else {
  11. EnterFrameBeacon.add(function(event:Event):void {
  12. if (--numFrames <= 0) {
  13. EnterFrameBeacon.remove(arguments.callee);
  14. callback();
  15. }
  16. });
  17. }
  18. }
  19. }
  20. }