# Flash and XML

**URL:** https://forum.kirupa.com/t/flash-and-xml/240675
**Category:** Uncategorized
**Created:** [October 4, 2007, 10:30pm UTC](https://forum.kirupa.com/t/flash-and-xml/240675 "2007-10-04T22:30:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![popkes01](https://avatars.discourse-cdn.com/v4/letter/p/f1d935/32.png) [@popkes01](https://forum.kirupa.com/u/popkes01)
#### Post date: [October 4, 2007, 10:30pm UTC](https://forum.kirupa.com/t/flash-and-xml/240675/1 "2007-10-04T22:30:58Z")

</div>

Hi.

I’m using kirupa’s flash and xml tutorial to make a fading in slideshow. I was trying to modify some of the code so that the image will also fade out before the next one fades in.

Any ideas on how to achieve this? Thanks again.  
-popkes01

Here is my code:

> delay = 5000;

//-----------------------  
function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = ;  
description = ;  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.childNodes\*.firstChild.nodeValue;  
description\* = xmlNode.childNodes\*.firstChild.nodeValue;  
}  
firstImage();  
}  
else {  
content = “file not loaded!”;  
}  
}

xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“monarch.xml”);  
///////////////////////////////////////////////////  
/\*

listen = new Object();  
listen.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
prevImage();  
}  
else if (Key.getCode() == Key.RIGHT) {  
nextImage();  
}  
};  
\*/

p = 0;  
this.onEnterFrame = function() {  
filesize = picture.getBytesTotal();  
loaded = picture.getBytesLoaded();  
preloader.\_visible = true;  
if (loaded != filesize) {  
preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
}  
else {  
preloader.\_visible = false;  
if (container\_mc.\_alpha\<100) {  
container\_mc.\_alpha += 2;  
}  
}  
}

function nextImage() {  
if (p\<(total-1)) {  
p++;  
if (loaded == filesize) {  
container\_mc.\_alpha = 0;  
container\_mc.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
picture\_num();  
slideshow();  
}  
}  
}

function prevImage() {  
if (p\>0) {  
p–;  
container\_mc.\_alpha = 0;  
container\_mc.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
picture\_num();  
}

}

function firstImage() {  
if (loaded == filesize) {  
container\_mc.\_alpha = 0;  
container\_mc.loadMovie(image[0], 1);  
desc\_txt.text = description[0];  
picture\_num();  
slideshow();  
}

}

function picture\_num() {  
current\_pos = p+1;  
pos\_txt.text = current\_pos+" / "+total;  
}

function slideshow() {  
myInterval = setInterval(pause\_slideshow, delay);  
function pause\_slideshow() {  
clearInterval(myInterval);  
if (p == (total-1)) {  
p = 0;  
firstImage();  
}  
else {  
nextImage();  
}  
}  
}
