# Image gallery xml based

**URL:** <https://forum.kirupa.com/t/image-gallery-xml-based/101203>\
**Category:** Uncategorized\
**Created:** [February 7, 2004, 12:46am UTC](https://forum.kirupa.com/t/image-gallery-xml-based/101203 "2004-02-07T00:46:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imported\_mucho](https://avatars.discourse-cdn.com/v4/letter/i/3da27b/32.png) [@imported\_mucho](https://forum.kirupa.com/u/imported_mucho)\
**Post date:** [February 7, 2004, 12:46am UTC](https://forum.kirupa.com/t/image-gallery-xml-based/101203/1 "2004-02-07T00:46:22Z")

</div>

Hi All,

I’m trying to create a image gallery that has next and previous buttons as well as direct buttons. eg. click on #15 and it will show #15. pretty simple, i guess…

here’s what I have, the next, previous works, but the direkt thing doesnt. Thanks for your help,

## mucho

images\_xml = new XML();  
images\_xml.onLoad = startImageViewer;  
images\_xml.load(“xml/images.xml”);  
images\_xml.ignoreWhite = true;

function startImageViewer(success) {  
if (success == true) {  
rootNode = images\_xml.firstChild;  
totalImages = rootNode.childNodes.length;  
firstImageNode = rootNode.firstChild;  
currentImageNode = firstImageNode;  
currentIndex = 1;  
updateImage(firstImageNode);  
}  
}

function updateImage(newImageNode) {  
imagePath = newImageNode.attributes.imgURL;  
targetClip.loadMovie(imagePath);  
imageCount = "Viewing image " + currentIndex + " of " + totalImages;  
}

next\_btn.onRelease = function() {  
nextImageNode = currentImageNode.nextSibling;  
if (nextImageNode == null) {  
break;  
} else {  
currentIndex++;  
updateImage(nextImageNode);  
currentImageNode = nextImageNode;  
}  
};

back\_btn.onRelease = function() {  
previousImageNode = currentImageNode.previousSibling;  
if (previousImageNode == null) {  
break;  
} else {  
currentIndex–;  
currentImageNode = previousImageNode;  
updateImage(previousImageNode);  
}  
};

button01.onRelease = function() {  
previousImageNode = imageNode01;  
if (previousImageNode == null) {  
break;  
} else {  
currentIndex–;  
currentImageNode = previousImageNode;  
updateImage(previousImageNode);  
}  
};  
button02.onRelease = function() {  
nextImageNode = currentImageNode.nextSibling;  
if (nextImageNode == null) {  
break;  
} else {  
currentIndex++;  
updateImage(nextImageNode);  
currentImageNode = nextImageNode;  
}  
};

button03.onRelease = function() {  
nextImageNode = imageNode03;  
if (nextImageNode == null) {  
break;  
} else {  
currentIndex++;  
updateImage(nextImageNode);  
currentImageNode = nextImageNode;  
}  
};

the XML file  
\<?xml version=“1.0”?\>

\<IMAGES\>  
\<imageNode imgURL=“images/01.jpg” /\>  
\<imageNode imgURL=“images/02.jpg” /\>  
\<imageNode imgURL=“images/03.jpg” /\>

\</IMAGES\>  
\<IMAGESDIRECT\>

```
&lt;imageNode01 imgURL="images/01.jpg" /&gt;
&lt;imageNode02 imgURL="images/02.jpg" /&gt;
&lt;imageNode03 imgURL="images/03.jpg" /&gt;

```

\</IMAGESDIRECT\>
