0 Replies Latest reply on Jul 10, 2015 9:35 PM by _andresRuiz_

    Canvas html5 | Control timeline with javascript

    _andresRuiz_

      Hi there!

       

      Im doing a canvas/html5 project in Flash Pro CC 2015.
      I have the file with multiple frames (as pages) and I navigate them with buttons placed in the html (not inside the canvas).
      To control timeline, I wrote in the first frame this lines:

       

      document.getElementById("nav_next").addEventListener('click', nextSlide.bind(this));

      document.getElementById("nav_prev").addEventListener('click', prevSlide.bind(this));


      function nextSlide() {

              this.gotoAndStop(this.currentFrame+1);

      }

       

      function prevSlide() {

              this.gotoAndStop(this.currentFrame-1);

      }


      It works fine, the matter is that project grows, and I made a couple other files with diferent canvas who load in the same html (consecutively); and I want to have control of navigation over the whole project (not each canvas separatedly). And I dont know how to do it since I need to use bind(this) to control the file.

      Any help is well received! thanks a lot!