HELP! (with "sliding menu" tutorial)

Hey, all. Obviously I’m new here, and thus far have found the tutorials and such here extremely helpful. I have run into a bit of a problem though.

On a page I’m currently designing, I have an area where I want the name of the page that the person is currently on to “slide” to the new location when the click on a button. I did the tutorial located here:

http://www.kirupa.com/developer/flash8/slidingMenu.htm

When I completed the tutorial and tested it, it worked fine. However, when I tried to implement this same effect into my design, it was going one spot too far. For example, when on the home page, the name should display “What is UBULL?” in the box. When the user clicks on the “How Does UBULL Work?” link, the box should display “How Does it Work?”. However, it continues to display “What is UBULL”, which should be the home page name. When clicking back then on the “Home” link, it goes past the “What is UBULL” text to a blank area.

I’ve compared the code several times with the code in the tutorial and can’t understand why it’s doing this. I initially wanted mine to “slide” vertically, and was running into the problems above, so I tried to have them slide horizontally, since the tut was done in that matter, and had the same results.

Here is the code in my movie:
[SIZE=1]var currentPosition:Number = _root.pagenamesHold.whatisubull._y;[/SIZE]
[SIZE=1]var startFlag:Boolean = false;[/SIZE]
[SIZE=1]menuSlide = function (input:MovieClip) {[/SIZE]
[SIZE=1]if (startFlag == false) {[/SIZE]

[SIZE=1]startFlag = true;[/SIZE]

[SIZE=1]var finalDestination:Number = input._y;[/SIZE]
[SIZE=1]var distanceMoved:Number = 0;[/SIZE]
[SIZE=1]var distanceToMove:Number = Math.abs(finalDestination-currentPosition);[/SIZE]
[SIZE=1]var finalSpeed:Number = .3;[/SIZE]
[SIZE=1]var currentSpeed:Number = 0;[/SIZE]
[SIZE=1]var dir:Number = 1;[/SIZE]

[SIZE=1]if (currentPosition<=finalDestination) {[/SIZE]
[SIZE=1]dir = -1;[/SIZE]
[SIZE=1]} else if (currentPosition>finalDestination) {[/SIZE]
[SIZE=1]dir = 1;[/SIZE]
[SIZE=1]}[/SIZE]

[SIZE=1]this.onEnterFrame = function() {[/SIZE]
[SIZE=1]currentSpeed = Math.round((distanceToMove-distanceMoved+1)finalSpeed);[/SIZE]
[SIZE=1]distanceMoved += currentSpeed;[/SIZE]
[SIZE=1]_root.pagenamesHold._y += dircurrentSpeed;[/SIZE]

[SIZE=1]if (Math.abs(distanceMoved-distanceToMove)<=1) {[/SIZE]
[SIZE=1]_root.pagenamesHold._y = maskMovie._y-currentPosition+dirdistanceToMove;[/SIZE]*
[SIZE=1]currentPosition = input._y;[/SIZE]
[SIZE=1]startFlag = false;[/SIZE]
[SIZE=1]delete this.onEnterFrame;[/SIZE]
[SIZE=1]}[/SIZE]
[SIZE=1]};[/SIZE]
[SIZE=1]}[/SIZE]
[SIZE=1]};[/SIZE]
[SIZE=1]b1.onRelease = function() {[/SIZE]
[SIZE=1]menuSlide(_root.pagenamesHold.whatisubull);[/SIZE]
[SIZE=1]};[/SIZE]
[SIZE=1]b2.onRelease = function() {[/SIZE]
[SIZE=1]menuSlide(_root.pagenamesHold.howdoesitwork);[/SIZE]
[SIZE=1]};[/SIZE]
[SIZE=1]b3.onRelease = function() {[/SIZE]
[SIZE=1]menuSlide(_root.pagenamesHold.manageaccount);[/SIZE]
[SIZE=1]};[/SIZE]
[SIZE=1]b4.onRelease = function() {[/SIZE]
[SIZE=1]menuSlide(_root.pagenamesHold.browsesearch);[/SIZE]
[SIZE=1]};[/SIZE]
[SIZE=1]b5.onRelease = function() {[/SIZE]
[SIZE=1]menuSlide(_root.pagenamesHold.contactus);[/SIZE]
[SIZE=1]};[/SIZE]

The code in the tut is obviously present there for comparison purposes.

Please help! I’m out of ideas and it slides correctly and everything, just goes one spot too far. Any help is greatly appreciated…I’m on quite a tight deadline on this one! :slight_smile: