Next and previous buttons in HTML5
Dear all thank you for yor time
I am making an animation that changes a frequency setting on a radio, to do this I need to have buttons that do both next and previous timline postions and then be able to to advance either one frame or two depending on the position selected. the counter display is in LCD digits which I have turned into vectors as there is not a LCD font in adobe or goolle fonts
.I put the code that CJ suggested on the main timeline with the buttons and it works but when I put the code and the buttons on the movie clip itself with the code then refer to the buttons via the movie clip I get an error saying the "digits_mc movie clip is not dfined ". How do I make CJ's code work from within a movie clip work.
this.stop()
stage.enableMouseOver(frequency)
var frameNumber = this.currentFrame;
let root = this;
var frequency = 3;
this.stop()
createjs.Touch.enable(stage);
// 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
if (!this.hasStarted)
{
this.prevFrame = function(e)
{
if (this.navigationLoop && this.currentFrame == 0)
this.gotoAndStop(this.timeline.duration - 1);
else
this.gotoAndStop(this.currentFrame - 1);
};
this.nextFrame = function(e)
{
if (!this.navigationLoop && this.currentFrame == this.timeline.duration - 1)
return;
this.gotoAndStop(this.currentFrame + 1);
};
this.digits_mc.prevButton.on("click", this.prevFrame, this);
this.digits_mc.nextButton.on("click", this.nextFrame, this);
this.stop();
this.hasStarted = true;
}I also tried putting the code on the main timeline and referencing the nested movie clip but it did not work, I must be doing something wrong but I cant figure out where I am going wrong.
Best regards
Peter
