package {
import flash.display.Sprite;
import flash.events.MouseEvent;
public class Main extends Sprite {
private var isDrawing:Boolean;
public function Main( ) {
graphics.lineStyle( 20, 0xFFCC33 );
isDrawing = false;
stage.addEventListener( MouseEvent.MOUSE_DOWN, startDrawing );
stage.addEventListener( MouseEvent.MOUSE_MOVE, draw );
stage.addEventListener( MouseEvent.MOUSE_UP, stopDrawing );
}
public function startDrawing( event:MouseEvent ):void {
graphics.moveTo( mouseX, mouseY );
isDrawing = true;
}
public function draw( event:MouseEvent ):void {
if ( isDrawing ) {
graphics.lineTo( mouseX, mouseY );
}
}
public function stopDrawing( event:MouseEvent ):void {
isDrawing = false;
}
}
}