# Draw dynamic line between two draggable MC's

**URL:** <https://forum.kirupa.com/t/draw-dynamic-line-between-two-draggable-mcs/165495>\
**Category:** Uncategorized\
**Created:** [October 11, 2005, 3:14pm UTC](https://forum.kirupa.com/t/draw-dynamic-line-between-two-draggable-mcs/165495 "2005-10-11T15:14:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![forwardtrends](https://avatars.discourse-cdn.com/v4/letter/f/cab0a1/32.png) [@forwardtrends](https://forum.kirupa.com/u/forwardtrends)\
**Post date:** [October 11, 2005, 3:14pm UTC](https://forum.kirupa.com/t/draw-dynamic-line-between-two-draggable-mcs/165495/1 "2005-10-11T15:14:14Z")

</div>

I’ve got a movie with four draggable MC’s - they represent four points on a line chart and only move vertically (named D, I, S, C). To improve the realism of the chart I need to dynamically draw lines between each point.

Inside each symbol on the stage is a button, the actions for each button ar similiar to:

```auto
 on (press) {
	startDrag("d_slider", false, 0, -198, 0, 198);
	}
on (release, releaseOutside) {
	stopDrag();
	_root.d_var.text = int(((Number(((d_slider._y/396)*(8-(-8)))) + Number(0)) * -1)*100)/100;
	}

```

In the \_root of the I’m using (this one draws a line from D to I):

```auto
_root.createEmptyMovieClip("line_mc", 1);

MovieClip.prototype.drawLine = function()
{
line_mc.clear();
line_mc.lineStyle(1,0xFF0000,100);
line_mc.moveTo(D._x, D._y);
line_mc.lineTo(I._x, I._y);
}

line_mc.drawLine();

```

But how can I get it to follow and redraw the line each time one of the MC’s is moved? If I put another startDrag in it will screw up the initial drag code I have above… Can anyone see a way to integrate these or any help would be greatly appreciated.

Thanks,

Aaron

> **[Web Developer, Designer, Artist, WordPress Expert - Aaron Elliott](https://forwardtrends.com/)**
>
> Forward Trends is the full service studio of Aaron Elliott who designs, builds and hosts Custom WordPress websites and other web design projects. Experienced Programmer, Graphic Designer, Digital Artist and Business Consultant. Based in New Castle,...
