# Help.. need to change codes to suit user interface

**URL:** <https://forum.kirupa.com/t/help-need-to-change-codes-to-suit-user-interface/191791>\
**Category:** flash\
**Created:** [June 23, 2006, 1:52am UTC](https://forum.kirupa.com/t/help-need-to-change-codes-to-suit-user-interface/191791 "2006-06-23T01:52:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![santalea](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@santalea](https://forum.kirupa.com/u/santalea)\
**Post date:** [June 23, 2006, 1:52am UTC](https://forum.kirupa.com/t/help-need-to-change-codes-to-suit-user-interface/191791/1 "2006-06-23T01:52:24Z")

</div>

can someone help me with the changing of the codes? instead of setting the intervals, i want to change it into something like adding a textbox for users to enter the intervals. and i also want to try to change the codes so that only when the user click, then the arrow would move.  
so its two separate favors… 1.adding textbox… 2.using onMouseDown function to move the arrow.

> 

var targetIndex:Number = 1;  
//var xValues:Array = [100,200,220,300,330,370];  
//var yValues:Array = [100,150,220,300,310,400];  
var tarArray:Array = [[0,0], [10,10], [100,100], [200,150], [220,220], [300,300], [330,310], [370,400]];  
this.createEmptyMovieClip(“line\_mc”, 1); //creating the line  
this.attachMovie(“arrowmc”, “arrowmc”, this.getNextHighestDepth()); //inserting the mc  
line\_mc.lineStyle(2, 0xFF00FF, 30);  
line\_mc.moveTo(tarArray[0][0], tarArray[0][1]); // starting point of the target  
arrowmc.\_x = tarArray[targetIndex][0]; //starting point of the arrow x-coordinate  
arrowmc.\_y = tarArray[targetIndex][1]; //starting point of the arrow x-coordinate  
var move\_int = setInterval(moveChaser,50); //setting time delay between movements  
function moveChaser() {  
//works out the angle in radians between tarArray[targetIndex] and arrowmc  
var theta:Number = Math.atan2(tarArray[targetIndex][1] - arrowmc.\_y, tarArray[targetIndex][0] - arrowmc.\_x);  
arrowmc.\_rotation = (theta \* 180 / Math.PI)+90; //makes radians in to degrees and orientates it 90 more degrees

if(Math.abs((tarArray[targetIndex][0]-arrowmc.\_x)) \> 2 || Math.abs((tarArray[targetIndex][1]-arrowmc.\_y)) \> 2){  
arrowmc.\_x += Math.cos(theta) \* 3;  
arrowmc.\_y += Math.sin(theta) \* 3;  
line\_mc.lineTo(arrowmc.\_x , arrowmc.\_y);  
}  
if(arrowmc.hitTest(tarArray[targetIndex][0],tarArray[targetIndex][1],false)){  
targetIndex++;  
}  
if(tarArray[targetIndex][0] == undefined){  
clearInterval(move\_int);  
trace(“successful”);  
}  
updateAfterEvent();  
};
