Skip to main content
Participant
August 12, 2022
Question

Looping HTML5 canvas is duplicating event listeners on loop

  • August 12, 2022
  • 1 reply
  • 192 views

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! 

    This topic has been closed for replies.

    1 reply

    Ross5E7BAuthor
    Participant
    August 12, 2022

    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!