asking
asking

Reputation: 1445

EaselJS : Animation not respecting stop flag

I've created various Sprites from a SpriteSheet to represent different state-animations, like intro, reset, etc, no problem.

// other code...
"animations": {"intro": [0, 19, "false"], "reset": [19, 25, "false"]}

// other code...
var intro = new createjs.Sprite(spriteSheet, "intro");

// add to stage, etc...

Based on this configuration, if I add the intro animation to the stage, it runs and stops as expected on frame index 19. However, I wanted to call:

intro.gotoAndStop(0);

...so the app launches and the intro animation sits on the first frame until an event triggers the start of the animation, and this works, but once I call:

intro.play();

...the intro animation plays, but now loops over and over again, even though it has been defined with a "false" flag to stop on the last frame (see animations object, above). What duh?

Any idears here? I'd like the intro animation to truly stop where I've asked it to do so. Do I have to manually manage this with event listeners? What am I missing?

Would be great if the Sprite API had a playUntil(9); or playFromTo(0, 4); to cut down on all the boiler plate.

Upvotes: 2

Views: 1733

Answers (1)

renatopp
renatopp

Reputation: 1315

You have to use false (boolean) instead of "false" (string)

Upvotes: 2

Related Questions