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>
<imageNode01 imgURL="images/01.jpg" />
<imageNode02 imgURL="images/02.jpg" />
<imageNode03 imgURL="images/03.jpg" />
</IMAGESDIRECT>