Play until frame?
There's gotoAndPlay() and gotoAndStop(), but is there a function to play until a frame number?
The functions I mentioned directly jump to that frame, I want the animation to play until that frame and then stop.
There's gotoAndPlay() and gotoAndStop(), but is there a function to play until a frame number?
The functions I mentioned directly jump to that frame, I want the animation to play until that frame and then stop.
I have a bunch of buttons numbered from one to ten.
Then I have a shape tween that goes from size zero to size ten.
If I press the button six, the shape tween should grow to size six. I can get the frame number to which it should go and stop, but I don't want it to just jump to that frame and stop.
I want the shape tween to animate until that frame and then stop.
I see. Tricky. Well, this is somewhat abusing the way Animate wants to work, but give this a shot:
createjs.MovieClip.prototype.playTo = function(dest) {
this.playtoFrame = this.timeline.resolve(dest);
this.timeline.removeEventListener("change", this.playtoListener);
if (this.playtoFrame > this.timeline.position) {
this.playtoListener = this.timeline.addEventListener("change", (function(evt) {
if (this.timeline.position === this.playtoFrame) {
this.paused = true;
evt.remove();
}
}).bind(this));
this.play();
}
}
Just paste somewhere in your setup code, probably the first frame. Then call as e.g.--
this.myClip.playTo(5);
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.