# Gallery help, next/previous buttons not working

**URL:** <https://forum.kirupa.com/t/gallery-help-next-previous-buttons-not-working/181076>\
**Category:** flash\
**Created:** [March 6, 2006, 8:09am UTC](https://forum.kirupa.com/t/gallery-help-next-previous-buttons-not-working/181076 "2006-03-06T08:09:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaintedSwan](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@PaintedSwan](https://forum.kirupa.com/u/PaintedSwan)\
**Post date:** [March 6, 2006, 8:09am UTC](https://forum.kirupa.com/t/gallery-help-next-previous-buttons-not-working/181076/1 "2006-03-06T08:09:43Z")

</div>

Hey 🙂

My question is in reference to the hybrid gallery described here [http://www.kirupa.com/forum/showthread.php?t=202184](http://www.kirupa.com/forum/showthread.php?t=202184)

Basically I am attempting to create a next and previous button for this particular version of the gallery. I know what’s going wrong, I just don’t know _why_. Here’s my code:

```auto

function dopress() {
 for (var i = 0; i<cliparray.length; i++) {
  scroll.paper["btn"+i].thmb.gotoAndStop(1);
  cliparray*._visible = 0;
  if (scroll.paper["btn"+i].okay == true) {
   scroll.paper["btn"+i].enabled = true;
   scroll.paper["btn"+i]._alpha = 100;
  }
 }
trace(this)
 this.enabled = false;
 border.resizeMe(myarray[this.ivar].holder, myarray[this.ivar].holder._width, myarray[this.ivar].holder._height, this.ivar+1);
 info.text = myarray[this.ivar].title;
 this._parent._parent._parent.next.onRelease = function() {
  if (ivar<cliparray.length-1) {
   ivar++;
   doPress();
  } else {
   ivar = 0;
   doPress();
  }
 };
prev.onRelease = function() {
 if (ivar>0) {
  ivar--;
  doPress();
 } else {
  ivar = cliparray.length-1;
  doPress();
 }
}

```

[FONT=Courier New][/FONT]

The code works fine if I just navigate the gallery pictures via the prev/next buttons, the problem arises when I click on one of the thumbs itself. When I do a trace within the doPress() function, if I click on the prev or next button and then click back on a thumb, somehow “this” becomes \_level0, instead of “\_level0.scroll.paper[“btn”+i]” as it should be. So I think I’m not calling the ivar variable correctly, but everything I’ve tried has failed. Any help would be appreciated. 🙂

-Swan
