Reputation: 3697
I am building a simple game with a few animations and I am having a problem with a loop extended from starling.
My code uses sprite sheets and texture atlas to fetch the animation sprites but when I add
anim.loop = false
the animation doesn't play at all. My code looks like:
anim = new MovieClip(Assets.getAtlasDuck().getTextures("duck_"), 20);
anim.loop = false;
starling.core.Starling.juggler.add(anim);
this.addChild(anim);
if I remove the loop the animation plays but loops. If I add:
anim.addEventListener(starling.events.Event.COMPLETE, duckComplete);
the animation doesn't play. the duckComplete function just removes the animation from the juggler.
I want the animation to play once and then stop. Even adding:
anim.play();
doesn't play the animation with the event listener or the loop = false.
Thanks
Upvotes: 0
Views: 3005
Reputation: 17237
After adding the MovieClip with a loop property set to false to the Juggler you have to control the clip manually using these MovieClip functions:
anim.play();
anim.pause();
anim.stop();
Upvotes: 2