# Problem drawing lines

**URL:** https://forum.kirupa.com/t/problem-drawing-lines/124684
**Category:** Uncategorized
**Created:** [October 5, 2004, 10:27pm UTC](https://forum.kirupa.com/t/problem-drawing-lines/124684 "2004-10-05T22:27:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![H4T](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/h4t/32/329_2.png) [@H4T](https://forum.kirupa.com/u/H4T)
#### Post date: [October 5, 2004, 10:27pm UTC](https://forum.kirupa.com/t/problem-drawing-lines/124684/1 "2004-10-05T22:27:51Z")

</div>

I know, its sad; having trouble drawing lines. Anyway, I have two movieclips that travel around the stage, and my goal is to draw the triangle the vectors form dynamically. However, when I draw these lines, they keep drawing over and over, and I want the lines to be redrawn each frame…clearing the old line.

When I use the clear(); function, no lines show up at all…here’s my code, any help?

```auto
drawLines = function() {
 	_root.createEmptyMovieClip("aLine",3);
 	_root.createEmptyMovieClip("bLine",4);
 	_root.createEmptyMovieClip("cLine",5);
 	
 	aLine.lineStyle(2,0xFF0000,100);
 	bLine.lineStyle(2,0x0000FF,100);
 	cLine.lineStyle(2,0xFFFF00,100);
 	
 	this.onEnterFrame = function() {
 		aLine.moveTo(ball1._x,ball1._y);
 		aLine.lineTo(ball2._x,ball1._y);
 		
 		Line.moveTo(ball2._x,ball2._y);
 		bLine.lineTo(ball2._x,ball1._y);
 		
 		cLine.moveTo(ball1._x,ball1._y);
 		cLine.lineTo(ball2._x,ball2._y);
 		
 		aLine.clear();
 		bLine.clear();
 		cLine.clear();
 	}
 }

```

This is the code for just the function which draws the lines.
