8 Replies Latest reply on Mar 24, 2017 11:26 AM by marjoleinp37350879

    How to link from a button to another page?




      I've been trying for a few days to get my buttons to link to other pages in my website, but I can't get it to work. Let me explain what my project looks like.


      I've got a HTML5 Canvas document, in which I've created an animation. At the end of the animation two buttons appear. I would like to be able to click on these buttons to go to another page inside my website. My buttons are on different layers. I've added the standard HTML5 code snippet, but it doesn't work, not even with the standard adobe.com as URL.
      In the console I get this error:


      Uncaught TypeError: Cannot read property 'addEventListener' of undefined

          at lib.animation.frame_159 (animation.js:836)

          at a.b._runActions (createjs-2015.11.26.min.js:17)

          at a.b.setPosition (createjs-2015.11.26.min.js:17)

          at a.b.setPosition (createjs-2015.11.26.min.js:17)

          at lib.animation.c._updateTimeline (createjs-2015.11.26.min.js:14)

          at lib.animation.c.advance (createjs-2015.11.26.min.js:14)

          at lib.animation.c._tick (createjs-2015.11.26.min.js:14)

          at a.b._tick (createjs-2015.11.26.min.js:13)

          at a.b.tick (createjs-2015.11.26.min.js:13)

          at a.b.update (createjs-2015.11.26.min.js:13)

          at a.b.handleEvent (createjs-2015.11.26.min.js:13)


      My code looks like this (tipsinfo_btn is the instance name of (one of) my button):


      /* Click to Go to Web Page

      Clicking on the specified symbol instance loads the URL in a new browser window.



      1. Replace http://www.adobe.com with the desired URL address.

         Keep the quotation marks ("").



      this.tipsinfo_btn.addEventListener("click", fl_ClickToGoToWebPage_5);


      function fl_ClickToGoToWebPage_5() {

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



      ------------------------------------------------------------------------------------------ -------------------------------

      I don't get why tipsinfo_btn is 'undefined', as the console tells me. Because I named it, and added the standard code to it.




      I hope there's someone who knows what I'm doing wrong!

      Thanks a lot!