Pencil tool drawing using flash actionscript

Pencil tool drawing flash actionscript.

var _pencilHold:Boolean = false;

function PencilDrawing():void
{
	graphics.lineStyle(1,0x000000);

	stage.addEventListener(MouseEvent.MOUSE_DOWN, StartDrawing, false, 0, true);
	stage.addEventListener(MouseEvent.MOUSE_MOVE, Drawing, false, 0, true);
	stage.addEventListener(MouseEvent.MOUSE_UP,   StopDrawing, false, 0, true);
}

function StartDrawing($e:MouseEvent):void
{
	graphics.moveTo( mouseX, mouseY);
	_pencilHold = true;
}

function Drawing($e:MouseEvent):void
{
	if(_pencilHold)
	graphics.lineTo(mouseX,mouseY);

}

function StopDrawing($e:MouseEvent):void
{
	_pencilHold = false;
}

PencilDrawing();

This movie requires Flash Player 9

Tags: , ,

Hi, Stranger! Leave Your Comment...

Name (required)
Email (required)
Website