Any ideas on the below - if I move the b1 - button1 into a MC why this wont work? I’m not sure what I need to change… I’ve been trying everything I can think of
thanks!
var currentPosition:Number = contentHold.content1._y;
var startFlag:Boolean = false;
menuSlide = function (input:MovieClip) {
if (startFlag == false) {
startFlag = true;
var finalDestination:Number = input._y;
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._y += dir*currentSpeed;
if (Math.abs(distanceMoved-distanceToMove)<=1) {
contentHold._y = maskMovie._y-currentPosition+dir*distanceToMove;
currentPosition = input._y;
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);
};
b6.onRelease = function() {
menuSlide(contentHold.content6);
};