# Forward and previous buttons

**URL:** <https://forum.kirupa.com/t/forward-and-previous-buttons/26189>\
**Category:** Uncategorized\
**Created:** [July 20, 2003, 7:20pm UTC](https://forum.kirupa.com/t/forward-and-previous-buttons/26189 "2003-07-20T19:20:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aristotle\_ps](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aristotle\_ps](https://forum.kirupa.com/u/aristotle_ps)\
**Post date:** [July 20, 2003, 7:20pm UTC](https://forum.kirupa.com/t/forward-and-previous-buttons/26189/1 "2003-07-20T19:20:52Z")

</div>

i created a movie in that i placed 4 slides in a layer1 in frame 5,25,45,65,85.

i had created a movieclip a rectangle in shape whish is static in a layer2

on rollover the movieclip rectangle i placed 2 buttons one is “previous” button and another is “forward” button.

on running this i want the button operations like the following

1. on clicking the “forward” button the the movie have to go to the slide 25.
2. from there if we click the “forward” button it should go to 45and so on.

like this

1. on clicking the “previous” button from the frame 45 it should go to the 25 frame of the movie and so on.

every thing is working but what the code i write in the button which is in the (rectangle shape)movie has taking the only one action. ie., when i write on(release){ \_root.gotoandplay(“25”)}  
it is globel to all position on the button.  
so only this action can only is taking place.

so i want the action script to be global and as well as my above constrains should also satisfied.

for this what to do

pls help me out

from  
aristotle

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2003, 7:24pm UTC](https://forum.kirupa.com/t/forward-and-previous-buttons/26189/2 "2003-07-20T19:24:52Z")

</div>

I would say to change your code on your forward button to \_root.gotoAndPlay(\_currentframe + 20). And then change it to - 20 for your back button. This would make it jump 20 frames from your current position. Does that help?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2003, 8:11pm UTC](https://forum.kirupa.com/t/forward-and-previous-buttons/26189/3 "2003-07-20T20:11:34Z")

</div>

This is kinda obvious, but if you use gotoAndPlay(25) it’ll play until your next stop(); actions so, you forward button should be a little different than 20, but drclare is correct in using that command  
[AS]  
//forward button if your stop() actions are on 6,26,46,66,86  
on(release){  
\_root.gotoAndPlay(\_currentframe+1);  
}  
//back button  
on(release){  
\_root.gotoAndPlay(\_currentframe-39);  
}  
[/AS]  
(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2003, 9:04pm UTC](https://forum.kirupa.com/t/forward-and-previous-buttons/26189/4 "2003-07-20T21:04:28Z")

</div>

oh, oops. That’s a good point.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2003, 9:11pm UTC](https://forum.kirupa.com/t/forward-and-previous-buttons/26189/5 "2003-07-20T21:11:32Z")

</div>

Hey, you got the concept!! Besides, _Knowing is half the battle!!_ [SIZE=1]…little GIJOE allusion for you…[/SIZE]
