I need help with Sliding Page ActionScript

Hi,

I would like you to please check the attached file, i’ve created a sliding menu which makes my pages slide. There are 3 buttons in the menu which slides up and down and the pages which slide imports external swf’s from out. I don’t want to do the external pages right now.

When i click the first button in the menu it works fine, when i click on the second button it slides correctly same with the third button. But the main problem is that if i click on the sencond button and the second page slides and rollOut of the menu it then closes and the page which is the second becomes as first ( because when i open the menu and click on the first one it does’nt open ). I HOPE U UNDERSTOOD ME TILL THIS POINT.

You can take a look at the attached file.

This is the code for the sliding and the buttons:


 
var currentPosition:Number = _root.pages_mc.ao_mc.contentHold.ao1._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; 
_root.pages_mc.ao_mc.contentHold._x += dir*currentSpeed; 
if (Math.abs(distanceMoved-distanceToMove)<=1) { 
_root.pages_mc.ao_mc.contentHold._x = maskMovie._x-currentPosition+dir*distanceToMove; 
currentPosition = input._x; 
startFlag = false; 
delete this.onEnterFrame; 
} 
}; 
} 
}; 

b1.onRelease = function() { 
menuSlide(_root.pages_mc.ao_mc.contentHold.ao1);
_root.pages_mc.ao_mc.contentHold.ao1.holder_mc.loadMovie("pages/aboutoman/pg1.swf",1);
}; 
b2.onRelease = function() { 
menuSlide(_root.pages_mc.ao_mc.contentHold.ao2); 
_root.pages_mc.ao_mc.contentHold.ao2.holder_mc.loadMovie("pages/aboutoman/pg2.swf",1);
}; 
b3.onRelease = function() { 
menuSlide(_root.pages_mc.ao_mc.contentHold.ao3); 
_root.pages_mc.ao_mc.contentHold.ao3.holder_mc.loadMovie("pages/aboutoman/pg3.swf",1);
};