From e2b933b40885a0b16e9938dee2b31fca2132a33c Mon Sep 17 00:00:00 2001 From: Yaski Date: Sat, 12 May 2012 14:49:26 +0600 Subject: [PATCH] ScriptTimeoutError:: fixed in AnimationController --- .../engine3d/animation/AnimationClip.as | 14 +++++--------- .../engine3d/animation/AnimationController.as | 5 ++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/alternativa/engine3d/animation/AnimationClip.as b/src/alternativa/engine3d/animation/AnimationClip.as index 420d9be..584a6a2 100644 --- a/src/alternativa/engine3d/animation/AnimationClip.as +++ b/src/alternativa/engine3d/animation/AnimationClip.as @@ -237,13 +237,14 @@ package alternativa.engine3d.animation { _time += interval*speed; if (loop) { if (_time < 0) { + // TODO: Loop processing // _position = (length <= 0) ? 0 : _position % length; _time = 0; } else { if (_time >= length) { collectNotifiers(oldTime, length); _time = (length <= 0) ? 0 : _time % length; - collectNotifiers(0, _time); + collectNotifiers(0, _time < oldTime ? _time : oldTime); } else { collectNotifiers(oldTime, _time); } @@ -351,17 +352,12 @@ package alternativa.engine3d.animation { * @private */ alternativa3d function collectNotifiers(start:Number, end:Number):void { - var notify:AnimationNotify = _notifiersList; - while (notify != null) { - if (notify._time > start) { - if (notify._time > end) { - notify = notify.next; - continue; - } + for (var notify:AnimationNotify = _notifiersList; notify != null; notify = notify.next) { + if (notify._time > start && notify._time <= end) { + // add notify to dispatched notify.processNext = controller.nearestNotifyers; controller.nearestNotifyers = notify; } - notify = notify.next; } } diff --git a/src/alternativa/engine3d/animation/AnimationController.as b/src/alternativa/engine3d/animation/AnimationController.as index b817478..f22fe64 100644 --- a/src/alternativa/engine3d/animation/AnimationController.as +++ b/src/alternativa/engine3d/animation/AnimationController.as @@ -132,10 +132,13 @@ package alternativa.engine3d.animation { } } // Calls the notifications - for (var notify:AnimationNotify = nearestNotifyers; notify != null; notify = notify.processNext) { + for (var notify:AnimationNotify = nearestNotifyers; notify != null;) { if (notify.willTrigger(NotifyEvent.NOTIFY)) { notify.dispatchEvent(new NotifyEvent(notify)); } + var nt:AnimationNotify = notify; + notify = notify.processNext; + nt.processNext = null; } nearestNotifyers = null; }