# Next/Prev XML not working for image gallery

**URL:** <https://forum.kirupa.com/t/next-prev-xml-not-working-for-image-gallery/286550>\
**Category:** flash\
**Created:** [April 16, 2009, 10:38pm UTC](https://forum.kirupa.com/t/next-prev-xml-not-working-for-image-gallery/286550 "2009-04-16T22:38:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkoes](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@rkoes](https://forum.kirupa.com/u/rkoes)\
**Post date:** [April 16, 2009, 10:38pm UTC](https://forum.kirupa.com/t/next-prev-xml-not-working-for-image-gallery/286550/1 "2009-04-16T22:38:48Z")

</div>

Hi there…

doing a website for a photographer, the next/prev buttons don’t seem to be working. I use the same xml techniques & code for next/prev i usually use… Tho it doesnt seem to be working at all… heres the code… Code is below… any help would be REALLY appreciated! 🙂

```auto
import mx.transitions.*;
import mx.transitions.easing.*;

var xmlPhotosengland:XML = new XML();
var initThumb:Object = new Object();
var nextX = 0;
var totalthumbs1:Number;

xmlPhotosengland.onLoad = function() {
	totalthumbs1 = xmlPhotosengland.firstChild.childNodes.length;
	for (var i:Number = 0; i<xmlPhotosengland.firstChild.childNodes.length; i++) {
		initThumb.photo = (xmlPhotosengland.firstChild.childNodes*.attributes.photo);
		initThumb.ID = i+1;
		makeAThumb(i);
		nextX += 50;
	}
	setInterval(_root.england,"scroller",50);
};

initThumb.onRollOver = function() {
	thumbFade = new Tween(this, "_alpha", Strong.easeOut, 50, 100, .2, true);
};
initThumb.onRollOut = function() {
	thumbFadeBack = new Tween(this, "_alpha", Strong.easeOut, 100, 50, .2, true);
};
initThumb.onRelease = function() {
	p = this.ID;
	_root.empty.emptyBig.loadMovie("Images/England/"+this.photo+".jpg");
};

function makeAThumb(num) {
	thumbName = "mcThumb"+num;
	englandScroller.attachMovie("thumb",thumbName,num,initThumb);
	englandScroller[thumbName].mcPhoto.loadMovie("Images/England/thumbs/"+englandScroller[thumbName].photo+".jpg");
	englandScroller[thumbName]._x = nextX;
	englandScroller[thumbName]._y = -30;
	englandScroller[thumbName]._alpha = 50;
}

function scrollerKill() {
	scroller = null;
	englandScroller._x = 0;
}
function scroller() {
	if (this._ymouse>-80) {
		var scrollSpeed = (this._xmouse-Stage.width/2)/50;
		if (Math.abs(scrollSpeed)<1) {
			scrollSpeed = 0;
		}
		usaScroller._x -= scrollSpeed;
		if (englandScroller._x>0) {
			englandScroller._x = 0;
		} else if (englandScroller._x<Stage.width-englandScroller._width) {
			englandScroller._x = Stage.width-englandScroller._width;
		}
		if (englandScroller._width<Stage.width) {
			scrollerKill();
		}
	}
}

xmlPhotosengland.ignoreWhite = true;
xmlPhotosengland.load("photosengland.xml");
this.createEmptyMovieClip("englandScroller",this.getNextHighestDepth());
mcThumb1._x = 0;
mcThumb1._y = -30;

var p:Number = 1;
var picpath:String;
var thisgalthumbs:Number;

function nextImage() {
    if(p < thisgalthumbs){
        ++p;
        if(p < 10){ 
            empty.emptyBig.loadMovie("Images/England/"+"00"+p+".jpg");
        }else{
            empty.emptyBig.loadMovie("Images/England/"+"0"+p+".jpg");
        }
    }else{
        p = 0;
        nextImage();
    }
};

_root.next_btn.onRelease = function() {
        thisgalthumbs = totalthumbs1;
		trace("next")
        nextImage();
};

function prevImage() {
    if(p > 1){
        --p;
        if(p < 10){ 
            empty.emptyBig.loadMovie("Images/England/"+"00"+p+".jpg");
        }else{
            empty.emptyBig.loadMovie("Images/England/"+"0"+p+".jpg");
        }
    }else{
        p = thisgalthumbs+1;
        prevImage();
    }
};

_root.prev_btn.onRelease = function() {
        thisgalthumbs = totalthumbs1;
		trace("prev")
        prevImage();
};

```
