# New lines, lineTo and moveTo issues

**URL:** https://forum.kirupa.com/t/new-lines-lineto-and-moveto-issues/306751
**Category:** Uncategorized
**Created:** [March 21, 2010, 9:35pm UTC](https://forum.kirupa.com/t/new-lines-lineto-and-moveto-issues/306751 "2010-03-21T21:35:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![oddtimeflux](https://avatars.discourse-cdn.com/v4/letter/o/258eb7/32.png) [@oddtimeflux](https://forum.kirupa.com/u/oddtimeflux)
#### Post date: [March 21, 2010, 9:35pm UTC](https://forum.kirupa.com/t/new-lines-lineto-and-moveto-issues/306751/1 "2010-03-21T21:35:42Z")

</div>

I’ve built a drawing application. Because I’ve programmed the option to insert symbols (new movieclips), I needed to create a new movieclip each time I start drawing. The problem is that I now completely messed up my lineTo and moveTo sequence, and it just draws from coordinates which I don’t understand where is gets them from.

The code section is basically:

\*stage.addEventListener( MouseEvent.MOUSE\_DOWN, startDrawing );  
stage.addEventListener( MouseEvent.MOUSE\_MOVE, drawer );

function drawer( e:MouseEvent ):void  
{  
if ((drawing) && (symbolsChoice == 1)) {  
var shDrawing:MovieClip = new MovieClip();  
shDrawing.graphics.lineStyle( strokeWidth, strokeColor, strokeAlpha, true, LineScaleMode.NONE, CapsStyle.ROUND);  
shDrawing.graphics.moveTo(\*\*shDrawing.mouseX, shDrawing.mouseY \*\*);  
shDrawing.graphics.lineTo( shDrawing.mouseX, shDrawing.mouseY );  
lineDrawing.addChild(shDrawing);

```
    }

```

}

function startDrawing(e:MouseEvent ):void  
{ … }\*

As you can see, I have a main lineDrawing movieclip into which i’m creating a new shDrawing each time the mouse moves. The problem is, because it starts a new movieclip each time - it messes up the coordinates of the line drawing.

(btw, I can solve this if I could only do some kind of “lineTo” function on a movieclip, so that it “lines-to” from mouse down to mouse up seamlessly, regardless of the speed of moving the mouse. any ideas?)
