# Paint /w cursor and curveTo

**URL:** <https://forum.kirupa.com/t/paint-w-cursor-and-curveto/317071>\
**Category:** flash\
**Created:** [December 9, 2010, 4:31pm UTC](https://forum.kirupa.com/t/paint-w-cursor-and-curveto/317071 "2010-12-09T16:31:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esseti](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@Esseti](https://forum.kirupa.com/u/Esseti)\
**Post date:** [December 9, 2010, 4:31pm UTC](https://forum.kirupa.com/t/paint-w-cursor-and-curveto/317071/1 "2010-12-09T16:31:02Z")

</div>

```auto

var sp:Sprite = new Sprite();

stage.addEventListener(MouseEvent.MOUSE_MOVE, drawIt);

var p:Array = new Array();

function drawIt(e:MouseEvent):void {
	p.push(new Object());
	p[p.length-1].x = mouseX;
	p[p.length-1].y = mouseY;
	
	if (p.length > 3) {
		sp.graphics.lineStyle(1);
		sp.graphics.moveTo(p[p.length-3].x, p[p.length-3].y);
		sp.graphics.curveTo(p[p.length-2].x, p[p.length-2].y, p[p.length-1].x, p[p.length-1].y);
	};
}
addChild(sp);

```

Is this the correct way to draw a smooth line between mouse movements? It kinda works, but sometimes I get weird artifacts.
