Hi, I have an animation that loads up and I can click the asset to have it play the animation. Thats great.
The issue I have is, when the asset first loads up it appears to be resting on the very last frame of the Spine animation and not the first frame.
How can I get the animation asset to be forced to the first frame of the animation?
I was looking for something like skeleton.state.setAnimationFrame(0);
similar to gotoAndStop(1) in AS3
Thanks
- Patrick
addEventListener( TouchEvent.TOUCH, onClick );
var json : SkeletonJson = new SkeletonJson( new StarlingAtlasAttachmentLoader( sAssets.getTextureAtlas( "spine-texture" ) ) );
var skeletonData : SkeletonData = json.readSkeletonData( sAssets.getObject( "spine-json" ) );
skeleton = new SkeletonAnimation( skeletonData, true );
addChild( skeleton );
private function onClick(event : TouchEvent) : void
{
Starling.juggler.add( skeleton );
var touch : Touch = event.getTouch( this );
if (touch && touch.phase == TouchPhase.BEGAN)
{
skeleton.state.setAnimationByName( 0, "intro", false );
}
}