[FONT=Courier New]there are 4 buttons that i created
-to move 1 step
-to move 10 step
-to move 50 step
-to move 100 step
now i try using if… else if… to control the movements as in below:
[AS]
var factor:Number = 1;
if(stepFifty.onRelease = true){
stepFifty.onRelease = function(){
while(targetIndex<(50*factor)){
//test if there anymore targets
if(targetIndex<mUnit.length){
//object moves to the coordinates from the Database
selfmc._x = mUnit[targetIndex].mLong;
selfmc._y = mUnit[targetIndex].mLati;
//creates a line using the Array value
line_mc.lineTo(selfmc._x, selfmc._y);
}
//to go to the next Array
targetIndex++;
}
factor++;
trace("Factor: " + factor);
}
}else if(stepHun.onRelease = true){
stepHun.onRelease = function(){
while(targetIndex<(100*factor)){
//test if there anymore targets
if(targetIndex<mUnit.length){
//object moves to the coordinates from the Database
selfmc._x = mUnit[targetIndex].mLong;
selfmc._y = mUnit[targetIndex].mLati;
//creates a line using the Array value
line_mc.lineTo(selfmc._x, selfmc._y);
}
//to go to the next Array
targetIndex++;
}
factor++;
trace("Factor: " + factor);
}
}
[/AS]
but it juz won’t work…[/FONT]