4 Replies Latest reply on Feb 17, 2016 12:57 AM by Stavros Papadakis

    removeEventListener in Adobe Animate CC is not working

    Stavros Papadakis Level 1

      Hi, I'm trying to remove an event Listener in Adobe Animate CC, but it won't work.

      Whereas removeAllEventListeners() works as expected, the this.removeEventListener('click', functionName.bind(this)); isn't and I can't seem to find out why.

       

      Here is my sample code:

       

      this.box1.addEventListener("click", moveMe.bind(this));

      function moveMe() {

           this.box1.x+=10;

      }

       

      this.box2.addEventListener("click", stopMove.bind(this));

      function stopMove() {

           this.box1.removeEventListener("click", moveMe); // I have also tried this.box1.removeEventListener("click", moveMe.bind(this));

      }

       

      Any suggestions?

      Thank you!