Runtimes for AS-3 (only) have the bug for any Spine animation:
After creation of new SkeletonAnimation() instance start playing from Random frame !!!
Bug in SkeletonSprite constructor !
lastTime MUST be initialized in Constructor : e.g. lastTime = getTimer();
Right now in first call of enterFrame() we got this bug
var time:int = getTimer();
// lastTime == 0
(time - lastTime)/1000 == HUGE amount of frames.
advanceTime( HUGE amount of frames );
FIX :
public class SkeletonSprite extends Sprite {
static private var blendModes:Vector.<String> = new <String>[
BlendMode.NORMAL, BlendMode.ADD, BlendMode.MULTIPLY, BlendMode.SCREEN];
private var _skeleton:Skeleton;
public var timeScale:Number = 1;
private var lastTime:int;
private var wrappers:Dictionary = new Dictionary(true);
public function SkeletonSprite (skeletonData:SkeletonData) {
Bone.yDown = true;
_skeleton = new Skeleton(skeletonData);
_skeleton.updateWorldTransform();
// To Fix add next line :
// lastTime = getTimer();
addEventListener(Event.ENTER_FRAME, enterFrame);
}
private function enterFrame (event:Event) : void {
var time:int = getTimer();
advanceTime((time - lastTime) / 1000);
lastTime = time;
}
Best regards,
Michael
spb.mihail.gor@gmail.com