# AS3 drawing api - creating a line that follows my mouse

**URL:** <https://forum.kirupa.com/t/as3-drawing-api-creating-a-line-that-follows-my-mouse/241906>\
**Category:** flash\
**Created:** [October 19, 2007, 9:25am UTC](https://forum.kirupa.com/t/as3-drawing-api-creating-a-line-that-follows-my-mouse/241906 "2007-10-19T09:25:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![clot](https://avatars.discourse-cdn.com/v4/letter/c/e9c0ed/32.png) [@clot](https://forum.kirupa.com/u/clot)\
**Post date:** [October 19, 2007, 9:25am UTC](https://forum.kirupa.com/t/as3-drawing-api-creating-a-line-that-follows-my-mouse/241906/1 "2007-10-19T09:25:35Z")

</div>

I’m sure this is pretty simple but can’t figure it out.

I want to set a point to start my line from and have the other end of the line follow my mouse. Here’s what I have so far:

```auto
var clip:Shape = new Shape()
addChild(clip);

stage.addEventListener(MouseEvent.MOUSE_MOVE, drawLine);

function drawLine(evt:MouseEvent)
{
clip.graphics.moveTo(0,0);
clip.graphics.lineTo(mouseX, mouseY);
clip.graphics.lineStyle(1, 0xff9933);
}

```

but it’s constantly drawing the line due to my mouse\_move listener.

I only want one line on stage - know what I mean? :panda:
