# Updating variables for simple photo gallery

**URL:** https://forum.kirupa.com/t/updating-variables-for-simple-photo-gallery/209639
**Category:** Uncategorized
**Created:** [December 11, 2006, 3:21am UTC](https://forum.kirupa.com/t/updating-variables-for-simple-photo-gallery/209639 "2006-12-11T03:21:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![risita](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/risita/32/1050_2.png) [@risita](https://forum.kirupa.com/u/risita)
#### Post date: [December 11, 2006, 3:21am UTC](https://forum.kirupa.com/t/updating-variables-for-simple-photo-gallery/209639/1 "2006-12-11T03:21:19Z")

</div>

Hi,

I’m making a simple photo gallery using the great [easing tutorial by Voetsjoeba](http://www.kirupa.com/developer/flash8/easing.htm). There’s a bar movieclip with buttons inside, the buttons are numbers 1-20. When you click on a number, the bar slides into an X position, bringing that number to the center of a highlighted area. Then there’s a next and a previous arrow to advance one by one. Pretty simple… But I’m still learning my variables so I’m not sure how to make the next and previous buttons work.

I have the X positions defined for each number like this:  
nX1 = 393;  
nX2 = 340;  
etc.

Then I’m moving each number like this:  
//n2 is the instance name of the #2 button  
bar.n2.onRelease = function(){  
\_root.bar.easeX( nX2, 1.35 );  
nextX = nX3;  
prevX = nX2;  
}  
bar.n2.onRelease;

And the next button works like this:  
Bnext.onRelease = function(){  
\_root.bar.easeX( nextX, 1.35 );  
}

Since the movie starts with #1,  
nextX = nX2;

And it does go to the next number, but only once, as it’s not updating the value of nextX, same goes for the previous button. I feel like there must be an easy way to do this, but I can’t figure it out… Any help would be much appreciated!!!

👼
