# Help moving lines!

**URL:** <https://forum.kirupa.com/t/help-moving-lines/213036>\
**Category:** flash\
**Created:** [January 16, 2007, 3:07pm UTC](https://forum.kirupa.com/t/help-moving-lines/213036 "2007-01-16T15:07:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thequ1ck](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@thequ1ck](https://forum.kirupa.com/u/thequ1ck)\
**Post date:** [January 16, 2007, 3:07pm UTC](https://forum.kirupa.com/t/help-moving-lines/213036/1 "2007-01-16T15:07:13Z")

</div>

Hi, I’m trying to create a series of drawing points that I can  
subsequently move around the screen.

but I’m having trouble getting the drawLines() function to  
execute changes in all of the lines, very confusing/???

Script below if anyone can help.

attachMovie(“bg”, “\_bg”, this.getNextHighestDepth());  
attachMovie(“moveBtn”, “moveBtn”, this.getNextHighestDepth());  
moveBtn.onRelease = function ()  
{  
shiftPoints();  
}

function shiftPoints ()  
{  
for(var i:Number = 1; i \< index; i++)  
{  
myArray\*.xPos += 225;  
trace(myArray\*.xPos);  
drawLines();  
}  
}  
var index:Number = 1;  
var myArray:Array = [null];  
var currentX = myArray[index].xPos;  
var previousX = myArray[index - 1].xPos;  
var currentY = myArray[index].yPos;  
var previousY = myArray[index - 1].yPos;

\_bg.onRelease = function()  
{  
if(index==1){

myArray[1]= {xPos:\_xmouse, yPos:\_ymouse};

createPoint(index, \_xmouse, \_ymouse);

index++  
}  
else  
{  
myArray[index]= {xPos:\_xmouse, yPos:\_ymouse};

createPoint(index, \_xmouse, \_ymouse);

index++

drawLines();  
}  
}  
\_bg.onReleaseOutside = _bg.onRelease;  
 bg.onEnterFrame = function ()  
{  
if (index\>=3)  
{  
drawLines();  
}  
}  
function drawLines()  
{  
removeLines();  
for(var i:Number = 2; i \<= index; i++)  
{  
tmpClip = this.createEmptyMovieClip("line" + index, index+900);  
tmpClip.lineStyle(2, 0x0, 100);  
tmpClip.moveTo(myArray[index-1].xPos, myArray[index-1].yPos);  
tmpClip.lineTo(myArray[index-2].xPos, myArray[index-2].yPos);  
}  
}  
function removeLines()  
{  
for(var i:Number = 1; i \< index; i++)  
{  
removeMovieClip("line_" + index);  
}  
}

function createPoint(id, xPos, yPos)  
{  
tmpClip = this.createEmptyMovieClip(“clip\_”+id, 500+id);  
tmpClip.lineStyle(10, 0x0, 20);  
tmpClip.moveTo(0, 0);  
tmpClip.lineTo(0.2, 0);  
tmpClip.\_x = xPos;  
tmpClip.\_y = yPos;  
tmpClip.id = id;  
tmpClip.onPress = function()  
{  
this.onMouseMove = function()  
{  
myArray[this.id].xPos = \_xmouse;  
myArray[this.id].yPos = \_ymouse;  
changeLines(this.id);  
changeLines(this.id+1);  
}  
}  
tmpClip.onRelease = function()  
{  
delete this.onMouseMove;  
\_quality = “BEST”;  
this.stopDrag();  
}  
tmpClip.onReleaseOutside = tmpClip.onRelease;  
}  
[//this.createEmptyMovieClip](https://this.createEmptyMovieClip)(“clip”, 0);
