I have one strange problem, if I use graphics.lineTo while moving the mouse (MOUSE_MOVE), the lines are created live. But if I change it to MOUSE_DOWN, the lines are straight, and unresponsive if the mouse is still being pressed.
Here’s an example:
stage.addEventListener(MouseEvent.MOUSE_MOVE, follow);
stage.addEventListener(MouseEvent.MOUSE_DOWN, draw);
private function follow(e:MouseEvent){
trace(e.localY);
activeChalk.x = e.stageX;
activeChalk.y = e.stageY;
}
private function draw(e:MouseEvent){
trace(e.localY);
activeChalk.x = e.stageX;
activeChalk.y = e.stageY;
board.graphics.lineTo(e.stageX,e.stageY);
}
EDIT: I managed to make it to work using the following example:
http://www.foundation-flash.com/tutorials/as3drawingbymouse/
Your application is fundamentally flawed in a variety of ways.
Instead of going in to detail, here’s a very simply implementation of drawing: