Skip to content

Commit

Permalink
now executing delayed call after dispatching REMOVE_FROM_JUGGLER event (
Browse files Browse the repository at this point in the history
closes Gamua#479)

That way, you can reset and reuse the delayed call right in the callback. This is now analog to how the 'onComplete' callback of Tweens work.
  • Loading branch information
PrimaryFeather committed Jan 28, 2014
1 parent f379ea7 commit 871a1c0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions starling/src/starling/animation/DelayedCall.as
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,24 @@ package starling.animation

if (previousTime < mTotalTime && mCurrentTime >= mTotalTime)
{
mCall.apply(null, mArgs);

if (mRepeatCount == 0 || mRepeatCount > 1)
{
mCall.apply(null, mArgs);

if (mRepeatCount > 0) mRepeatCount -= 1;
mCurrentTime = 0;
advanceTime((previousTime + time) - mTotalTime);
}
else
{
// save call & args: they might be changed through an event listener
var call:Function = mCall;
var args:Array = mArgs;

// in the callback, people might want to call "reset" and re-add it to the
// juggler; so this event has to be dispatched *before* executing 'call'.
dispatchEventWith(Event.REMOVE_FROM_JUGGLER);
call.apply(null, args);
}
}
}
Expand Down

0 comments on commit 871a1c0

Please sign in to comment.