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

Community Beginner ,
Nov 30, 2020

Copy link to clipboard

Copied

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

Views

198

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Adobe Community Professional , Dec 01, 2020
JoãoCésar Adobe Community Professional , Dec 01, 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

Likes

Translate

Translate
Jump to answer Jump to answer
LEGEND ,
Dec 01, 2020

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Dec 01, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
umr AUTHOR
Community Beginner ,
Dec 01, 2020

Copy link to clipboard

Copied

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;

 

}

 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Dec 01, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
umr AUTHOR
Community Beginner ,
Dec 01, 2020

Copy link to clipboard

Copied

Dear JoaCesar,

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

https://shared-assets.adobe.com/link/58ecad92-080a-49b1-4e5b-86f777fd7310

 

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

Usha

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Dec 01, 2020

Copy link to clipboard

Copied

Hi again.

 

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.

image.pngimage.png

 

Video showing how to download and open the file:

 

Please let me know if you still have any further questions.

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
umr AUTHOR
Community Beginner ,
Dec 01, 2020

Copy link to clipboard

Copied

Dear JoaCesar,

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

Usha

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Dec 01, 2020

Copy link to clipboard

Copied

No problem! You're welcome!

 

I'm glad it worked for you.

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
umr AUTHOR
Community Beginner ,
Dec 01, 2020

Copy link to clipboard

Copied

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

 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Dec 02, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
umr AUTHOR
Community Beginner ,
Dec 02, 2020

Copy link to clipboard

Copied

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.

Usha

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
umr AUTHOR
Community Beginner ,
Dec 02, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
umr AUTHOR
Community Beginner ,
Dec 03, 2020

Copy link to clipboard

Copied

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.

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Dec 04, 2020

Copy link to clipboard

Copied

Hi.

 

You're gonna need a server for your content to run properly.

 

Please see this answer:

Re: Urgent help need with Adobe Animate Publishing - Adobe Support Community - 11133282

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
umr AUTHOR LATEST
Community Beginner ,
Dec 07, 2020

Copy link to clipboard

Copied

Hi,

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.

Usha

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more