Drawing in ActionScript3

In this lesson we are going to create a drawing program. Start a new ActionScript3 file and label the first layer actionscript.
Create a MovieClip with the registration point in the top left corner that looks like a pencil.
Name the instance on the stage pencil.pencil
In the first frame of the actions layer add the following code:

Or you can download the Flash file.
Mouse.hide(); //hide the real cursor
pencil.mouseEnabled = false; //so you can click on other things, not the pencil
stage.addEventListener(MouseEvent.MOUSE_MOVE,moving);
function moving(e:MouseEvent):void {
	//make the pencil follow the real cursor
	pencil.x=mouseX;
	pencil.y=mouseY;
} //follow
Get Adobe Flash player

We will be adding to this movie throughout this lesson.

NEXT: Drawing Dots