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

Looping HTML5 canvas is duplicating event listeners on loop

New Here ,
Aug 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

I'm creating a looping HTML5 banner advert that loops and has several event listeners attached to buttons to fire links to different web pages.

 

When the artwork loops however, it's duplicating the event listeners so when I click a link it opens the url multiple times depending on the number of loops. 3 loops = 3 URLs opened. 10 loops = 10 new tabs.. 

 

How can I either force a singular link click or remove all event listeners before it loops? 

 

HELP! 

Views

78

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 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

LATEST

The code that had been inserted by Adobe Animate was as follows:

 

/* Click to Go to Web Page
Clicking on the specified symbol instance loads the URL in a new browser window.

 

Instructions:
1. Replace http://www.adobe.com with the desired URL address.
Keep the quotation marks ("").
*/

this.dijones_com_au.addEventListener("click", fl_ClickToGoToWebPage_1);

function fl_ClickToGoToWebPage_1() {
window.open("https://www.dijones.com.au", "_blank");
}

 

 

 

 

All other examples I've seen the code looked different so I've not been able to edit. 

 

Thanks in advance! 

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