• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Animate buttons not taking me to certain frames

New Here ,
May 01, 2019 May 01, 2019

Copy link to clipboard

Copied

I'm having a problem with some buttons on animate. The HTML is correct and the button has an instance name. I can go to the next frame or the frame after if I change the code but not the frame I need to go to. The rest of the buttons work perfectly, this is the only problematic one. The output mentions content using bitmap and buttons may cause errors but I've moved all of the buttons from these frames to new frames so I don't think it's that. Any ideas? Screen Shot 2019-05-01 at 12.47.17.pngScreen Shot 2019-05-01 at 12.47.39.png

Views

323

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , May 01, 2019 May 01, 2019

Hi.

You have three functions with the same name in the first image. Give them different names.

Regards,

JC

Votes

Translate

Translate
Community Expert ,
May 01, 2019 May 01, 2019

Copy link to clipboard

Copied

Hi.

You have three functions with the same name in the first image. Give them different names.

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 01, 2019 May 01, 2019

Copy link to clipboard

Copied

Okay, perfect, thank you! I need to ask though, what do I actually need to change? I'm a complete novice   . The this. lines of code?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 01, 2019 May 01, 2019

Copy link to clipboard

Copied

It seems you first image disappeared.

Anyway, following your approach, a practical and safe way would be like this:

function gotoFrame0(e)

{

     this.gotoAndStop(0);

}

function gotoFrame1(e)

{

     this.gotoAndStop(1);

}

function gotoFrame2(e)

{

     this.gotoAndStop(2);

}

if (!this.frame0Started) // this check is to prevent the buttons from receiving multiple listeners

{

     this.stop();

     this.button0.addEventListener("click", gotoFrame0.bind(this));

     this.button1.addEventListener("click", gotoFrame1.bind(this));

     this.button2.addEventListener("click", gotoFrame2.bind(this));

     this.frame0Started = true;

}

Each button gets a different handler function.

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 01, 2019 May 01, 2019

Copy link to clipboard

Copied

Ha ha! The missing first image now explains a lot!

I thought "I know João is really good... but I didn't know he was THIS good!!!" as I couldn't see the 3 functions in the first (now gone) image!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 01, 2019 May 01, 2019

Copy link to clipboard

Copied

LATEST

HAHAHAHAHAHA!

And I wish I was THIS good!

Votes

Translate

Translate

Report

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