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

Gotoandstop functions aren't working html5/canvas animate cc

New Here ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

I have a curious problem. Some buttons, which are all on separate layers, and some instances of the same button named uniquely, aren't functioning. I have a very simple function I'm trying to accomplish really. Once the button is clicked, the playhead moves to a desired frame and stops there. Some buttons work fine. On this frame, they aren't working.

Here's the code on this frame. I've verified the button names are correct. I used Animate's code authoring feature so eliminate my human factor of mistakes.

this.stop();

this.s1m1_btn.addEventListener("click", fl_ClickToGoToAndStopAtFrame_8.bind(this));

function fl_ClickToGoToAndStopAtFrame_8()

{

this.gotoAndStop(52);

}

this.backBtn.addEventListener("click", fl_ClickToGoToAndStopAtFrame_9.bind(this));

function fl_ClickToGoToAndStopAtFrame_9()

{

this.gotoAndStop(24);

}

Views

1.7K

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

LEGEND , Aug 02, 2017 Aug 02, 2017

You have it going to frames 42 and 52. It should be 41 and 51, because of how frames start at 0 when you run the published files.

Votes

Translate

Translate
Community Expert ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

remove that button from the keyframe that contains that code.

create (using a library symbol or otherwise) the button on that keyframe and assign its name in the properties panel.

retest.

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 ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

Thanks for your quick reply, Gladstein. I tried that yesterday and again just now. The button is on a separate layer than the code. I deleted it. I used a symbol from my library of the button I created yesterday. I gave it another instance name "backBtn21", just so it was different than previous. Still no luck. Any more ideas?

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 ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

Consequently, all of the buttons on this frame are not working. All are on separate layers.

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 ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

did you change your 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
New Here ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

Yes. I did change the code to reflect the new button instance name.

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 ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

kglad, you had originally said to "remove that button from the keyframe that contains that code". Are you asking if the button is on the same frame and layer that has the code? I'm assuming that buttons should not be placed on the same layer as the code itself. Is that correct?

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
LEGEND ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

Code can go on any layer. I think kglad was suggesting to recreate the button, in the hope that something is wrong with the current one.

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 ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

I've recreated the buttons several times. I think there's something glitchy going on, or I quite possibly might be losing my mind. Would anyone be willing to look at the files?

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
LEGEND ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

Yes, either post a link to the working (non-working) published files, or upload the FLA somewhere.

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 ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

I emailed you a link to my drop box. Let me know if you don't have it. Thanks!

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
LEGEND ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

You have it going to frames 42 and 52. It should be 41 and 51, because of how frames start at 0 when you run the published files.

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
LEGEND ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

When debugging, always test your assumptions.

You assume that "this.s1m1_btn" is the correct reference to use for addEventListener. Is it? Stick an alert(this.s1m1_btn); after it. And so on for each one.

You assume the event handlers are actually being called. Are they? Stick an alert(this) statement inside them.

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 ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

LATEST

Thanks so much, Colin! It works now!

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