# Next and prev function

**URL:** <https://forum.kirupa.com/t/next-and-prev-function/214387>\
**Category:** Uncategorized\
**Created:** [January 28, 2007, 12:57pm UTC](https://forum.kirupa.com/t/next-and-prev-function/214387 "2007-01-28T12:57:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SavvyQC](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@SavvyQC](https://forum.kirupa.com/u/SavvyQC)\
**Post date:** [January 28, 2007, 12:57pm UTC](https://forum.kirupa.com/t/next-and-prev-function/214387/1 "2007-01-28T12:57:00Z")

</div>

hi everyone!

i’m trying to build next/prev buttons to add to an existing slider bar. The slider bar scrolls as the mouse moves over it, and stops when the mouse is in center ‘x’. I’ve used the LoadMovie to dynamically load each photo when clicked. Here is the Movie as it stands right now–\>

[http://www.mastelectric.com/projects.html](http://www.mastelectric.com/projects.html)

The client really likes the setup, but wants to have next/prev buttons for the user to be able to manually ‘slideshow’ their way through, in addition to the current functionality. The photos still need to load dynamcially to keep oversize to a minimum.

Can someone help me flush out this code? I imagine it will go something like this:

for x = 1 to 46  
next\_btn.onRelease = function {

case: (target\_mc has NO pic loaded)  
then load p1.jpg

case: (target\_mc is occupied)  
then get (current picNum ((i.e.p34.jpg)) and load picNum +1

if picNum = 47  
then next\_btn.visible = false

};
