[Golist] Resume on LinearGo that hasn't started ruins sync
Stephen Downs
steve at plasticbrain.com
Mon Sep 29 03:09:13 PDT 2008
There seems to be a flaw in the way that the setup call in LinearGo
works when dealing with instances that haven't started yet and are
responding to a resume call.
Here's an example scenario:
LinearGo instance with:
delay: 2.5
duration: 3.0
Steps to replicate:
1) Start the LinearGo.
2) Pause the LinearGo at 2 seconds.
3) Resume the LinearGo.
Expected results:
LinearGo would begin play at 0.5 seconds after step 3 (finishing the
rest of it's delay phase, then starting the tween animation).
Actual results:
LinearGo begins play after another 2.5 seconds (as if it was reset).
Workaround:
Here's a kludge patch to the resume function you can implement in your
LinearGo extended class:
override public function resume() : Boolean {
if (_state != PlayStates.PAUSED)
return false;
var mult:Number = Math.max(0, timeMultiplier) * (_useFrames ? 1 :
1000);
var currentTime:Number = (_useFrames ? _currentFrame : getTimer());
var offsetTime:Number = currentTime - (_pauseTime - _startTime);
if (!_started) {
var offset:Number = (_useFrames ? Math.round(_delay * mult) :
(_delay * mult));
offsetTime -= offset;
}
setup(offsetTime);
_pauseTime = NaN;
_state = (_startTime > currentTime ? PlayStates.PLAYING_DELAY :
PlayStates.PLAYING);
dispatch(GoEvent.RESUME);
return true;
}
I imagine this flaw also kicks in when using skipTo as well.
Steve
More information about the GoList
mailing list