Does anyone know of any tutorials creating a drawing application with
an undo function like the graffiti application on facebook.

I've been trying to add a sprite to a drawing canvas ui component
class which is successful as follows, 


----------------------------------
private function beginLine():void 
{
var sprite:Sprite = new Sprite;
                        
sprite.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
sprite.addEventListener(MouseEvent.MOUSE_UP, onEndLine);
            
dwg_canvas.addChild(sprite);

sprite.graphics.moveTo(mouseX, mouseY);
sprite.graphics.lineStyle(lineWidth, lineColor, 1);
sprite.graphics.lineTo(mouseX+1, mouseY); // this draws a dot
}
----------------------------------


but when I create an EventListener on the sprite it doesn't go into
the mouseMove function which says


----------------------------------
private function onMouseMove(event:MouseEvent):void 
{
event.target.graphics.lineTo(mouseX, mouseY);
}
-----------------------------


the plan is to have all these sprites created then store the number in
the modelLocator so that in order to undo I just have to say

dwg_canvas.removeChildAt(spriteNum);

Again the main thing is not the code but just to get a basic undo
function working, so if anyone out there has any tutorials, that would
be great. 

thanks.




Reply via email to