# Photo Gallery - Back and Next function

**URL:** https://forum.kirupa.com/t/photo-gallery-back-and-next-function/319586
**Category:** flash
**Created:** [February 25, 2011, 10:20am UTC](https://forum.kirupa.com/t/photo-gallery-back-and-next-function/319586 "2011-02-25T10:20:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![vasilestan](https://avatars.discourse-cdn.com/v4/letter/v/ad7895/32.png) [@vasilestan](https://forum.kirupa.com/u/vasilestan)
#### Post date: [February 25, 2011, 10:20am UTC](https://forum.kirupa.com/t/photo-gallery-back-and-next-function/319586/1 "2011-02-25T10:20:40Z")

</div>

Hi all,

I want to add two buttons in as2 for a photo gallery. The funtions must be: go to next picture or go back. I’ve created my buttons “imageBack” and “imageNext”.

I’m not familiar with scripting and I need to create the script that does this operation. Any ideas?

The current status of the gallery is this script that enables to go on the next image when i click on the image but i have no options to go back

```auto

over.onPress = function() {
    if (pic<total-1) {
        pic++;
        loadPic(pic);
    }
};

```

Cristian
