# Button that need sum tweaking

**URL:** <https://forum.kirupa.com/t/button-that-need-sum-tweaking/196264>\
**Category:** Uncategorized\
**Created:** [August 7, 2006, 8:14am UTC](https://forum.kirupa.com/t/button-that-need-sum-tweaking/196264 "2006-08-07T08:14:22Z")\
**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:** [August 7, 2006, 8:14am UTC](https://forum.kirupa.com/t/button-that-need-sum-tweaking/196264/1 "2006-08-07T08:14:22Z")

</div>

[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]
