# How can I do this?

**URL:** https://forum.kirupa.com/t/how-can-i-do-this/203397
**Category:** Uncategorized
**Created:** [October 10, 2006, 7:10pm UTC](https://forum.kirupa.com/t/how-can-i-do-this/203397 "2006-10-10T19:10:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Navarone](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Navarone](https://forum.kirupa.com/u/Navarone)
#### Post date: [October 10, 2006, 7:10pm UTC](https://forum.kirupa.com/t/how-can-i-do-this/203397/1 "2006-10-10T19:10:29Z")

</div>

I want to draw a line with my mouse so that the line always remains straight. I want to click with my mouse and then the line start, move my mouse to a new location with the line trailing and then click my mouse again to end the line.

I was reading thru the tutorials on this site and came across the drawing room tut. It draws a line by draging the mouse. Unless you can drag your mouse super straight you get a crookedy line. How can I correct for this and do what I want?

```auto

// 1. SETTING THINGS
// ----------------
_root.createEmptyMovieClip("line", 1);
// 2. EVENTS IN _ROOT:
// ------------------------
_root.onMouseDown = function() {
 line.moveTo(_xmouse, _ymouse);
 line.lineStyle(0, 0x000000, 100);
 this.onEnterFrame = function() {
  line.lineTo(_xmouse, _ymouse);
 };
};
_root.onMouseUp = function() {
 this.onEnterFrame = null;
};
// 3. BUTTON "ERASE":
// --------------------
buttonErase.onPress = function() {
 _root.line.clear();
};

```
