# Help with next prev buttons

**URL:** <https://forum.kirupa.com/t/help-with-next-prev-buttons/229920>\
**Category:** Uncategorized\
**Created:** [June 21, 2007, 7:39am UTC](https://forum.kirupa.com/t/help-with-next-prev-buttons/229920 "2007-06-21T07:39:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kobalt7](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@kobalt7](https://forum.kirupa.com/u/kobalt7)\
**Post date:** [June 21, 2007, 7:39am UTC](https://forum.kirupa.com/t/help-with-next-prev-buttons/229920/1 "2007-06-21T07:39:16Z")

</div>

i have a movie clip thats populated with paragraphs of text i was hoping to get a little help with the conditional logic that would apply, i had it working but with errors so i took it apart and started from scratch  
basically i wanted the next and previous buttons to tween the movie clip the length of 2 paragraphs at a time, stopping at the front and the back heres what i got

if (ztotal\>2) {  
if(currentpage \<=ztotal &&total !=0 ){  
var sectin = b\_sections.attachMovie(“secbut”, “secbut”, 555);  
sectin.\_x = 1019;  
sectin.\_y = 49;  
sectin.\_alpha = 0;  
sectin.tween("\_alpha", 100, 1, “linear”, 0);  
sectin.onRollOver = onDragOver=function () {  
this.colorTo(0xFF7300, 1);  
};  
sectin.onRollOut = onDragOut=function () {  
this.colorTo(null, 1);  
};  
sectin.onRelease = function() {

```
        prevpage = Number(b_sections.pgno.pageno.text)-1;
        newpage = Number(b_sections.pgno.pageno.text)+1
        trace(sectin._x)
        b_sections.pgno.pageno.text = Number(newpage);
        this.tween("_y", 22, 1, "easeOutBounce", 0);
        b_sections.s_holder.tween("_x", b_sections.s_holder._x-835, 1, "easeOutExpo", 0);
        var sectin2 = b_sections.attachMovie("secbut2", "secbut2", 556);
        
        sectin2._x = 1019
        sectin2._y = 72;
        sectin2._alpha = 0;
        sectin2.tween("_alpha", 100, 1, "linear", .5);
        sectin2.onRelease = function() {
            b_sections.pgno.pageno.text = prevpage;
            this.tween("_alpha", 0, 1, "linear", 0);
            sectin.tween("_y", 49, 1, "easeOutBounce", 0);
            b_sections.s_holder.tween("_x", b_sections.s_holder._x+835, 1, "easeOutExpo", 0, function () {
                sectin2.removeMovieClip();
            });
        };
        }
    };
}
```
