title: Clearing the last graphic drawn? (Undo/Redo drawing)
body: <pre><code>public function drag(e:MouseEvent)
      {
          lineDraw(mouseX, mouseY);
          e.updateAfterEvent();
  
      }
      public function lineDraw(X:int, Y:int):void
      {
          currentX = X;
          currentY = Y;
  
          graphics.lineStyle(size, color)
          graphics.moveTo(previousX, previousY)
          graphics.lineTo(currentX, currentY)
  
          previousX = currentX;
          previousY = currentY;
      }
  </code></pre>
  
  <p>Very simple code I made that allows me to draw lines with my mouse. Function drag is triggered on <code>MOUSE_MOVE</code> after <code>MOUSE_DOWN</code>. </p>
  
  <p>My question is: how would I go about clearing the last line drawn? Basically, a <code>ctrl+z/undo</code> function that can be repeat as many times as i want. </p>
  
  <p>Would I have to rewrite my code completely and push every single line drawn into an array, and then work my way backwards through the array, removing lines as I click "undo"? Or is there another better, easier solution to this?</p>
  
  <p>Thanks! :)</p>