I need help with this code
I have a movie clip with several frames named step1, step2, step3.....
I have a button called next_btn
I want to add a code so when I press the button it will go and play the next label.
I need help
Your post was moved over from the "Using the Community" forum, which is for getting help using this forum system, to a better forum.
I hope this helps. Best of luck to you.
Copy link to clipboard
Please checkout the v2 folder in this link:
Just remember to replace the target Movie Clip instance name at the top and possibly the prev and next buttons names.
I hope this helps.
Thanks, but I still have a problem. I need a code to work within animate.
I have one that goes to next and previous frame that works that I put below- I want something simiollar but will go to next and previous lable. It used to be possible with AS3
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.back_btn.on("click", this.prevFrame, this);
this.next_btn.on("click", this.nextFrame, this);
this.hasStarted = true;
The code in the reference does just that: it allows navigation from label to label.
And what do you mean by "a code to work within animate"?
Your code looked like something I would have to use in my HTML site.
I need it to work from animate it self. I am not probably expressing myself properly.
I have shared my folder with you
This project is called hdbc Overview
Inside you will see 5 labels. Currently I have to use 5 buttons to go to each label.
I am looking to have just 2 buttons next and back that when clicked go to next /previous label.
I am not sure what you sent me will fit in the actions code.
Thanks for your patience
I think you didn't understand yet. The link goes to a folder in my GitHub repo which contains a FLA coded with the interaction you requested.
Video showing how to download and open the file:
Please let me know if you still have any further questions.
Thank you so much. It worked. I am sorry for not understanding what you were trying to say earlier.
Once again thank you, you have helped me more than you will ever know
No problem! You're welcome!
I'm glad it worked for you.
I cannot add this code at root and replace the target Movie Clip instance name - I added it inside the movie itself.
at root I have about 8 movie clips each in one frame.
Each movie clip has between 5-9 labels.
I just do not know if I should rpt that code 8 times and put a different target Movie clip name each time,
If you know a different solution like load the next movie from library let me know. I am not quite as savy as you.
I've just added a v3 to the same link.
Please keep in mind that these examples are not intended to be a complete solution, but just a reference to help you get started.
I hope they help.
It works on the main time line.
However the buttons only work on the movie named container, they do not work on other movies whose instant names are container1, contaoner2.....
I checked the instant name of buttons and they are all named correctly.
Found my mistake and corrected it.
It is working fine.
Thank you so much for your help.
You have been most helpful.
Hope I could once again ask you for help if needed.
I am having another problem.
The animation works when I test it by going to Control and press Test.
However when I publish it, the buttons do not work in the html while that is generated .
What am I doing wrong.
I wanted to tell you I solved the problem.
In publish settings for images I changed from texture to sprite and it works every time.