Skip to main content
Known Participant
December 1, 2020
Answered

Need code for goto next label and play in Animate CC canvas

  • December 1, 2020
  • 3 replies
  • 1984 views

Hi

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

Please advise

Usha

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

     

    Please checkout the v2 folder in this link:

    adobe/animate cc/html5_canvas/navigate_from_label_to_label at master · joao-cesar/adobe (github.com)

     

    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.

     

    Regards,

    JC

    3 replies

    umrAuthor
    Known Participant
    December 1, 2020

    Hi,

    I cannot add this code at root and replace the target Movie Clip instance name  - I added it inside the movie itself.

    Reason:

    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.

    Usha

     

     

    JoãoCésar17023019
    Community Expert
    Community Expert
    December 2, 2020

    Hi.

     

    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.

     

    Regards,

    JC

    umrAuthor
    Known Participant
    December 4, 2020

    Dear JoaoCesar,

    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.

    Usha


    Dear JoacCesar,

    Need Help

    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.

     

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    December 1, 2020

    Hi.

     

    Please checkout the v2 folder in this link:

    adobe/animate cc/html5_canvas/navigate_from_label_to_label at master · joao-cesar/adobe (github.com)

     

    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.

     

    Regards,

    JC

    umrAuthor
    Known Participant
    December 1, 2020

    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

     

    My code

    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.back_btn.on("click", this.prevFrame, this);

     

         this.next_btn.on("click", this.nextFrame, this);

     

         this.stop();

     

         this.hasStarted = true;

     

    }

     

     

    JoãoCésar17023019
    Community Expert
    Community Expert
    December 1, 2020

    Hi.

     

    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"?

    Just Shoot Me
    Legend
    December 1, 2020

    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.