1 Reply Latest reply on Aug 19, 2017 6:38 AM by ClayUUID

    Functions question in Animate Canvas

    John Locke 2013 Level 1

      I’m a little confused regarding communication between functions as the code below throws an undefined error.

       

      What I’m trying to accomplish, is a simple way that I can turn a group of EventListeners on and off. - Peter

       

      function startListen() {

       

       

        var binderbp1 = bp1_click.bind(this);

        this.bp1.addEventListener(“click", binderbp1);

       

        var binderbp2 = bp1_click.bind(this);

        this.bp1.addEventListener(“click", binderbp2);

       

        var binderbp3 = bp1_click.bind(this);

        this.bp1.addEventListener(“click", binderbp3);

       

      }

       

      function endListen() {

       

        this.bp1.removeEventListener("click", binderbp1);

        this.bp2.removeEventListener("click", binderbp2);

        this.bp3.removeEventListener("click", binderbp3);

       

      }

       

      startListen();

      endListen();