3 Replies Latest reply on Oct 30, 2012 12:16 PM by resdesign

    Clear canvas path

    resdesign Adobe Community Professional & MVP

      I have been trying to clear paths made with canvas on a map. The map has 10 paths that are started on the click event. I want to be able to reset the map with no path when all the path have been seen.

      path1.jpgpath2.jpg

      I tried:

      var myCanvas = $('<canvas />');

      myCanvas.attr("width", 780);

      myCanvas.attr("height", 470);

       

      btn = sym.$("btn");

      index = -1;

      btn.click(function(){

        index++;

        sym.play("p" + index);

        if (index>=7){

        index=-1;

        ctx0.clearRect(0,0,myCanvas[0].width,myCanvas[0].height);

        ctx1.clearRect(0,0,myCanvas[0].width,myCanvas[0].height);

        ctx6.clearRect(0,0,myCanvas[0].width,myCanvas[0].height);

        ctx2.clearRect(0,0,myCanvas[0].width,myCanvas[0].height);

        ctx3.clearRect(0,0,myCanvas[0].width,myCanvas[0].height);

        ctx4.clearRect(0,0,myCanvas[0].width,myCanvas[0].height);

        ctx5.clearRect(0,0,myCanvas[0].width,myCanvas[0].height);

       

        }

      });

       

       

      but it does not clear anything.