# Random XML Slideshow

**URL:** https://forum.kirupa.com/t/random-xml-slideshow/117009
**Category:** Uncategorized
**Created:** [July 23, 2004, 9:27am UTC](https://forum.kirupa.com/t/random-xml-slideshow/117009 "2004-07-23T09:27:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![johnny\_5\_alive](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@johnny\_5\_alive](https://forum.kirupa.com/u/johnny_5_alive)
#### Post date: [July 23, 2004, 9:27am UTC](https://forum.kirupa.com/t/random-xml-slideshow/117009/1 "2004-07-23T09:27:34Z")

</div>

It’s that time again - I pretend I know what I’m doing when it comes to Actionscript.

Here’s a mod to the MM XML slideshow that Mediachrome on were-here came up with:

stop();  
slides\_xml = new XML();  
slides\_xml.onLoad = startSlideShow;  
slides\_xml.load(“slides.xml”);  
slides\_xml.ignoreWhite = true;  
//  
// Show the first slide and intialize variables  
function startSlideShow(success) {  
if (success == true) {  
rootNode = slides\_xml.firstChild;  
totalSlides = rootNode.childNodes.length;  
firstSlideNode = rootNode.firstChild;  
currentSlideNode = firstSlideNode;  
currentIndex = 1;  
updateSlide(firstSlideNode);  
}  
}

//  
// Updates the current slide with new image and text  
function updateSlide(newSlideNode) {  
imagePath = newSlideNode.attributes.jpegURL;  
slideText = newSlideNode.firstChild.nodeValue;  
loadMovie(imagePath, targetClip);  
}  
//  
//AutoPlay code  
myImg = setInterval(test, 5\*1000);  
function test() {  
if (currentIndex\>=totalSlides or nextSlideNode == totalSlides+1) {  
currentIndex = 1;  
firstSlideNode = rootNode.firstChild;  
currentSlideNode = firstSlideNode;  
updateSlide(firstSlideNode);  
} else {  
nextSlideNode = currentSlideNode.nextSibling;  
currentIndex++;  
updateSlide(nextSlideNode);  
currentSlideNode = nextSlideNode;  
}  
}  
Can anyone help me to add a fade effect between each image? Please bear in mind I’m a designer and am more at home with pretty colours and interesting typography.

For some extra points I’d be for ever indebted to the person who could tell me how bring the slides out in a random order. That would blow my mind! I know I need to use Math.random but I don’t know how to apply it.

Thanks all. ![](http://www.were-here.com/forum/smilies/drool.gif)
