# Instead of moving, the object jumps from one point to another

**URL:** <https://forum.kirupa.com/t/instead-of-moving-the-object-jumps-from-one-point-to-another/194483>\
**Category:** Uncategorized\
**Created:** [July 24, 2006, 2:43am UTC](https://forum.kirupa.com/t/instead-of-moving-the-object-jumps-from-one-point-to-another/194483 "2006-07-24T02:43:21Z")\
**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:** [July 24, 2006, 2:43am UTC](https://forum.kirupa.com/t/instead-of-moving-the-object-jumps-from-one-point-to-another/194483/1 "2006-07-24T02:43:21Z")

</div>

the program below is suppose to make the object move instead of just jumping from one point to another. can someone help me modify my program so that it moves(what i mean by move is that is glides to the other point)… please… thank you…

[AS]  
#include “tomcatURL.as”  
stop();

import mx.controls.Button;

var mUnit:Array = new Array(i);  
var targetIndex:Number = 0;  
this.initMap(); //to include this function  
this.createEmptyMovieClip(“line\_mc”, 1); //draw line  
line\_mc.lineStyle(2, 0xFF00FF, 30);  
this.attachMovie(“arsmc”, “arsmc”, this.getNextHighestDepth());

var intervalTime:Number;

createClassObject(Button,“btnPara”, 99, {\_height:60, \_width:175, \_x:605, \_y:525}); //to create & insert button  
btnPara.\_visible = true;  
btnPara.enabled = true;  
btnPara.label = “Update Move”;  
btnPara.\_alpha = 100;

function tarTime():Void{  
btnPara.onRelease = function(){  
//test if there anymore targets  
if(targetIndex\<mUnit.length){  
//object moves to the coordinates from the Database  
arsmc.\_x = mUnit[targetIndex].mLong;  
arsmc.\_y = mUnit[targetIndex].mLati;  
//object moves at the angle from the Database  
arsmc.\_rotation = (mUnit[targetIndex].mAngle);  
//creates a line using the Array value  
line\_mc.lineTo(arsmc.\_x, arsmc.\_y);

trace("x, y: " + mUnit[targetIndex].mLong + “,” + mUnit[targetIndex].mLati);  
trace("angle: " + mUnit[targetIndex].mAngle);  
}  
//test for no more targets in mUnit  
if(mUnit[targetIndex].mLong == undefined){  
clearInterval(intervalTime);  
trace(“successful”);  
}  
//to go to the next Array  
targetIndex++;  
trace(“Target Index:” +targetIndex);  
}  
}

//to indicate the start  
function objStart():Void{  
this.attachMovie(“starmc”, “starmc”, this.getNextHighestDepth());  
starmc.\_x = mUnit[0].mLong;  
starmc.\_y = mUnit[0].mLati;  
starmc.\_alpha = 100  
trace("Start: " + mUnit[0].mLong + “,” + mUnit[0].mLati);  
}

function initMap():Void {  
var send\_lv:LoadVars = new LoadVars();  
var rec\_lv:LoadVars = new LoadVars();  
// read from test.mapping using mine.jsp  
send\_lv.sendAndLoad(\_global.serverURL + “mine.jsp”, rec\_lv, “POST”);  
rec\_lv.onLoad = function(success:Boolean) {  
if (success) {  
var i:Number = 0;  
while (rec\_lv[“Long”+i] != null){  
mUnit\* = new Mappie(rec\_lv[“Long”+i], rec\_lv[“Lati”+i], rec\_lv[“Ang”+i]);  
i++; //counting number of objects  
}

line\_mc.moveTo(mUnit[0].mLong, mUnit[0].mLati); //the start of the line  
objStart();  
intervalTime = setInterval(tarTime, 1000);  
}  
}  
}  
[FONT=Courier New][/AS][/FONT]
