# Actionscript macromedia 8 - perfectionist

**URL:** <https://forum.kirupa.com/t/actionscript-macromedia-8-perfectionist/246633>\
**Category:** flash\
**Created:** [December 12, 2007, 10:30pm UTC](https://forum.kirupa.com/t/actionscript-macromedia-8-perfectionist/246633 "2007-12-12T22:30:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phoenix83](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@phoenix83](https://forum.kirupa.com/u/phoenix83)\
**Post date:** [December 12, 2007, 10:30pm UTC](https://forum.kirupa.com/t/actionscript-macromedia-8-perfectionist/246633/1 "2007-12-12T22:30:08Z")

</div>

Firstly, here is my code

var currentPosition:Number = contentHold.content1.\_x;  
var startFlag:Boolean = false;  
menuSlide = function (input:MovieClip) {  
if (startFlag == false) {

startFlag = true;

var finalDestination:Number = input.\_x;  
var distanceMoved:Number = 0;  
var distanceToMove:Number = Math.abs(finalDestination-currentPosition);  
var finalSpeed:Number = .3;  
var currentSpeed:Number = 0;  
var dir:Number = 1;

if (currentPosition\<=finalDestination) {  
dir = -1;  
} else if (currentPosition\>finalDestination) {  
dir = 1;  
}

this.onEnterFrame = function() {  
currentSpeed = Math.round((distanceToMove-distanceMoved+1)_finalSpeed);  
distanceMoved += currentSpeed;  
contentHold.\_x += dir_currentSpeed;  
if (Math.abs(distanceMoved-distanceToMove)\<=1) {  
contentHold.\_x = maskholder.\_x-currentPosition+dir\*distanceToMove;  
currentPosition = input.\_x;  
startFlag = false;  
delete this.onEnterFrame;  
}  
};  
}  
};  
b1.onRelease = function() {  
menuSlide(contentHold.content1);  
};  
b2.onRelease = function() {  
menuSlide(contentHold.content2);  
};  
b3.onRelease = function() {  
menuSlide(contentHold.content3);  
};  
b4.onRelease = function() {  
menuSlide(contentHold.content4);  
};  
b5.onRelease = function() {  
menuSlide(contentHold.content5);  
};

right, at present if you jump from say button1 to button 2, it runs smoothly, however, if you do button1 to button 4 ie more than one place, you see button 2 and 3 move first ir the coloured blocks in this case.

I want to make the idea more pleasing to the eye, by having the colours slide straight from one to another without the jumping about. Am I trying to achieve the impossible?
