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

Two buttons, one doesn't work

Community Beginner ,
Apr 25, 2018 Apr 25, 2018

So I have two buttons on two different layers and I created each button separately to avoid any double instance issues. I am working in HTML 5 and in my script I have the function for both buttons on the same script frame.

this.stop();

this.path1.addEventListener("click", path1Clicked.bind(this));

function path1Clicked()

{

this.gotoAndPlay(2304);

}

this.path2.addEventListener("click", path2Clicked.bind(this));

function path2Clicked()

{

this.gotoAndPlay(2304);

}

The path2 button works and goes to frame 2304 when I click on it, however. The path1 button does not work and I still can click it as though its a button, but it doesn't goto frame 2304

195
Translate
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 , Apr 25, 2018 Apr 25, 2018

Hi.

I tested your code and it works.

Please double check your instances names.

Translate
Community Expert ,
Apr 25, 2018 Apr 25, 2018

Hi.

I tested your code and it works.

Please double check your instances names.

Translate
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 Beginner ,
Apr 25, 2018 Apr 25, 2018
LATEST

Thanks, something with the instances. I had to remake the buttons and that might of caused a double instance name somewhere I couldn't find the same name twice in my library, however. Changing path1 to just path fixed the script and now it works.

Translate
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