Your question is impossibly vague, like asking "What is the bulb for my light?" Be more specific.
Copy link to clipboard
I'm supposing you need navigation buttons like those of e-learning training. If that's the case, put this code in the first frame of the timeline in which the buttons are located:
// prevButton and nextButton are the instance names of the buttons
this.navigationLoop = true; // set to true or false to enable or disable loop when the current position is the first or the last frame
this.prevFrame = function(e)
if (this.navigationLoop && this.currentFrame == 0)
this.gotoAndStop(this.timeline.duration - 1);
this.gotoAndStop(this.currentFrame - 1);
this.nextFrame = function(e)
if (!this.navigationLoop && this.currentFrame == this.timeline.duration - 1)
this.gotoAndStop(this.currentFrame + 1);
this.prevButton.on("click", this.prevFrame, this);
this.nextButton.on("click", this.nextFrame, this);
this.hasStarted = true;
Awesome, thank you so much!!
FYI, CreateJS provides the totalFrames property, so there shouldn't be any reason to dig down into timeline.duration.
Thank you for posting your code
I have a major problem can't seem to work out
when i use your code to go fwd on a project it seems to work ok
but when I go back all the movie clips on the pages previous run once ,although they all have stop actions on them, also I tried to add a reset function telling all individual clips to gotoAndStop when prev button clicked does not work all movies all still run once.
Was simple in flash prev frame next frame.
any help appreciated
In CreateJS MovieClips stay in memory and remember everything they have done so far. You could have reset routines in all of the movieclips you use, or you could create a new movieclip from the library each time, after deleting the old one if this is the second time around.
Besides of what Colin suggested, you can try to set the autoReset property to false.
When this property is set to true, the Movie Clip instance will automatically be reset to its first frame whenever the timeline adds it back onto the display list.
Please let us know.
Thanks for that reminder. Which version of CreateJS was that added, and which version of Animate would be needed?