5 Replies Latest reply on May 17, 2018 9:12 AM by kglad

    "mouseup" not working in HTML5 canvas

    Sigurd.Eliassen Level 1



      I'm creating a HTML5 canvas where the main timeline is supposed to play while a button is pressed, and stop when the button is released. To achieve this, I need to stop the "tick" event on mouseup. However, mouseup is not working. I tried to use mouseup on the btn_plus.addEventListener as well (just for debugging purposes), but it doesn't do anything. "mousedown" and "click" work as intended.


      (The next step is to create a reverse button with similar functionality, that's why I'm not using play/stop to control the timeline.)


      Any input would be deeply appreciated.








      this.btn_plus.addEventListener("mousedown", keyPlus.bind(this));      //increase button. "mouseup" is not working here either.



      function keyPlus() {

              this.addEventListener("tick", increaseDown.bind(this));

              this.removeEventListener("mouseup", increaseDown.bind(this));      //Trying to remove the ticker here - not working




      function increaseDown() {

              this.gotoAndStop(this.timeline.position +1); //magic happens here

              //alert ("Increase pressed");