# Next/previous in sliding menu

**URL:** <https://forum.kirupa.com/t/next-previous-in-sliding-menu/232124>\
**Category:** flash\
**Created:** [July 11, 2007, 12:34pm UTC](https://forum.kirupa.com/t/next-previous-in-sliding-menu/232124 "2007-07-11T12:34:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![masskontroll](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@masskontroll](https://forum.kirupa.com/u/masskontroll)\
**Post date:** [July 11, 2007, 12:34pm UTC](https://forum.kirupa.com/t/next-previous-in-sliding-menu/232124/1 "2007-07-11T12:34:10Z")

</div>

Hi there, I’ve done this somewhat dated but great tutorial for a sliding menu:

[http://www.kirupa.com/developer/flash5/slidingmenu.htm](http://www.kirupa.com/developer/flash5/slidingmenu.htm)

You can basically place 1 large banner under a mask which shows only a small part of the banner and use buttons to navigate the mask to certain, pre-determined area of the banner.

The code for a button is like this:  
home\_btn.onPress = function () {  
\_root.xnew = \_root.mask2.\_x+(1-1)\*1000;  
}

‘home\_btn’ in this instance being linked to the first 1000px of the banner (the width of the mask). Now I’d like to add a ‘next’ & ‘previous’ button, but these are dependend on the location you’re at, so this code doesn’t suffice, because it generates a fixed location, no matter where you are. How can I alter this code, so that you either go 1000px forward, or 1000px backwards from the place on the banner you’re at?

I tried something like this:

prev\_btn.onPress = function () {  
\_root.xnew = \_root.mask2.\_x-1000;  
}

next\_btn.onPress = function () {  
\_root.xnew = \_root.mask2.\_x+1000;  
}

But that didn’t it work (“duh”). So what should it be? Any help much appreciated!
