# Go to Next/Previous Image in XML Photogallery using MouseWheel?

**URL:** <https://forum.kirupa.com/t/go-to-next-previous-image-in-xml-photogallery-using-mousewheel/255904>\
**Category:** flash\
**Created:** [March 28, 2008, 1:45am UTC](https://forum.kirupa.com/t/go-to-next-previous-image-in-xml-photogallery-using-mousewheel/255904 "2008-03-28T01:45:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![moonpilot](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@moonpilot](https://forum.kirupa.com/u/moonpilot)\
**Post date:** [March 28, 2008, 1:45am UTC](https://forum.kirupa.com/t/go-to-next-previous-image-in-xml-photogallery-using-mousewheel/255904/1 "2008-03-28T01:45:49Z")

</div>

Hi,

I have made a Photogallery in Flash, which displays one image at a time using the tutorial on this website. Now I want the user to be able to cycle through the images using the Mouse Wheel (scroll up = display previous image, scroll down = next image).

Heres what Ive got so far:

```auto

Mouse.addListener(mouseListener);
var mouseListener:Object = new Object();
mouseListener.onMouseWheel = function(delta) {
    if (delta > 0) {
            nextImage();
    } else {
            previousImage();
       }
}

```

Which does not seem to work - could someone please help me out with the correct code!

Thanks, Ben 🙂
