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

Clicking on a button opens multiple new tabs instead of only one

Community Beginner ,
Mar 11, 2019 Mar 11, 2019

Copy link to clipboard

Copied

I have this strange problem that started to happen recently, and have no idea how to fix it.

In Adobe Animate I created an animated HTML5 banner in HTML5 canvas, with button in it that leads me to an URL when I click that button.

But the problem is when I click that button it opens multiple new tabs instead only one. (Like this in the picture)

1.jpg

The way I created a button is on a new layer i created new rectangle with dimensions of whole canvas,

converted it to a new symbol (button), double click it to enter that symbol, and created a keyframe only on HIT state.

Then returned to "Scene 1", clicked on a button, put an instance name on that button and in code snippet wrote this code:

this.btn_name.addEventListener("click", fl_ClickToGoToWebPage);

function fl_ClickToGoToWebPage() {

window.open("http://www.adobe.com", "_blank");}

(ofc instead of adobe.com I put my own URL)

This method worked for me until now. But all of a sudden this problem started to appear.

I tried in 2 different versions of Adobe Animate (2018 & 2019) but the issue is still here.

And the interesting thing is that problem occurs only when I select "Loop timeline" in "Publish Settings..."

Without "Loop timeline" checked it works just fine.

I'm really stuck in limbo with this

Views

12.3K

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 , Mar 12, 2019 Mar 12, 2019

To make sure, try writing your code in one of the following ways:

function fl_ClickToGoToWebPage()

{

    window.open("http://www.adobe.com", "_blank");

}

if (!this.started)

{

    this.btn_name.addEventListener("click", fl_ClickToGoToWebPage);

    this.started = true;

}

OR

function fl_ClickToGoToWebPage()

{

    window.open("http://www.adobe.com", "_blank");

}

if (!this.btn_name.hasEventListener("click"))

    this.btn_name.addEventListener("click", fl_ClickToGoToWebPage);

Please let us know if the issue goes away.

...

Votes

Translate

Translate
Community Expert ,
Jul 23, 2021 Jul 23, 2021

Copy link to clipboard

Copied

LATEST

Hi.

 

Sure.

 

Just send me the link here or in private.

 

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