# Next/prev button in a loop help

**URL:** <https://forum.kirupa.com/t/next-prev-button-in-a-loop-help/240797>\
**Category:** Uncategorized\
**Created:** [October 6, 2007, 9:35am UTC](https://forum.kirupa.com/t/next-prev-button-in-a-loop-help/240797 "2007-10-06T09:35:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![genizah](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@genizah](https://forum.kirupa.com/u/genizah)\
**Post date:** [October 6, 2007, 9:35am UTC](https://forum.kirupa.com/t/next-prev-button-in-a-loop-help/240797/1 "2007-10-06T09:35:44Z")

</div>

```auto
for (j=0; j<70; j++) {
 var links = thumbsss.attachMovie("pt"+String(j), "pth"+String(j), j);
 posX = xIni+ln*int(j%18)-70;
 posY = yIni+hg*int(j/18);
 var uyuz:Tween = new Tween(links, "_x", Strong.easeOut, 0, posX, 1, true);
 var uyuz:Tween = new Tween(links, "_y", Strong.easeOut, 0, posY, 1, true);
 links.j = j;
 links._alpha = 50;
 
 links.onRollOver = function() {
  var uyur:Tween = new Tween(this, "_alpha", Strong.easeOut, this._alpha, 100, 1, true);
  var backeffect = b.attachMovie("pback"+String(this.j), "lolo", 1);
  var bafx:Tween = new Tween(backeffect, "_alpha", Strong.easeOut, 0, 100, 0.4, true);
 };
 links.onRollOut = function() {
  var uyur:Tween = new Tween(this, "_alpha", Strong.easeOut, this._alpha, 70, 1, true);
  back();
 };
 links.onRelease = function() {
  var movieefec = mcl2.loadClip("photography/people/p"+this.j+".swf", _root.jakabo);
  var moviex:Tween = new Tween(movieefec, "_alpha", Strong.easeOut, 0, 100, 0.4, true);
  var p:Number = this.j;
 
  _root.nextt.onRelease = function() {
   var movieefec = mcl2.loadClip("photography/people/p"+p+++".swf", _root.jakabo);
 
  };
  _root.prevv.onRelease = function() {
   mcl2.loadClip("photography/people/p"+p--+".swf",_root.jakabo);
 
 
  };
 };
}

```

hi,  
as you see above, i’m trying to create next/previous buttons for externally loading movies. it works ok except a situation that when i load some movie first then i click the next button, it loads the same movie, when i clicked 2nd time it loads the next movie…

i need your help about this.
