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?
// 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();
};