# Slideshow Problem

**URL:** <https://forum.kirupa.com/t/slideshow-problem/266079>\
**Category:** flash\
**Created:** [July 16, 2008, 2:56am UTC](https://forum.kirupa.com/t/slideshow-problem/266079 "2008-07-16T02:56:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aub5987](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@aub5987](https://forum.kirupa.com/u/aub5987)\
**Post date:** [July 16, 2008, 2:56am UTC](https://forum.kirupa.com/t/slideshow-problem/266079/1 "2008-07-16T02:56:01Z")

</div>

I’ve just recently started learning actionscript with most of knowledge coming from this site and others like it.

My website loads external swfs by clicking a button. In these swfs is dynamic text and a slideshow. It load the text and images from an xml file. As you click around the website the slideshow stops working properly. I’m not really sure why this happening. Does anyone have any suggestions?

Here is the code for the slideshow.

delay = 3000;

frame.swapDepths(9999); //image on top of slideshow

function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
total = xmlNode.firstChild.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.firstChild.childNodes\*.childNodes;  
}  
text\_holder.text = xmlNode.firstChild.nextSibling.childNodes;  
id = setInterval(preloadPic, 100);  
} else {  
content = “file not loaded!”;  
}  
}

xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(‘xmlcode/symbols.xml’);

var p = 0;  
var current;  
var k = 0;  
function preloadPic() {  
clearInterval(id);  
var con = picture.duplicateMovieClip(“con”+k, 9+k);  
con.loadMovie(image[p]);  
preloader.\_visible = 0;  
preloader.swapDepths(con.getDepth()+3);  
con.\_alpha = 0;  
var temp = \_root.createEmptyMovieClip(“temp”+k, 2+k);  
k++;  
temp.onEnterFrame = function() {  
var total = con.getBytesTotal();  
var loaded = con.getBytesLoaded();  
percent = Math.round(loaded/total\*100);  
preloader.preload\_bar.\_xscale = percent;  
if (con.\_width) {  
preloader.\_visible = 0;  
con.onEnterFrame = fadeIn;  
delete this.onEnterFrame;  
}  
};  
slideshow();  
}

MovieClip.prototype.fadeIn = function() {  
if (this.\_alpha\<100) {  
current.\_alpha -= 10;  
this.\_alpha += 10;  
} else {  
current.\_visible = 0;  
current = this;  
delete this.onEnterFrame;  
}  
};

function nextImage() {  
p\<total-1 ? (p++, preloadPic()) : null;  
}

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

---

<div class="post-metadata">

**Author:** ![aub5987](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@aub5987](https://forum.kirupa.com/u/aub5987)\
**Post date:** [July 27, 2008, 5:04pm UTC](https://forum.kirupa.com/t/slideshow-problem/266079/2 "2008-07-27T17:04:21Z")

</div>

[http://www.lopers.net/students/h/hilla1/alpha/example.html](http://www.lopers.net/students/h/hilla1/alpha/example.html)

Sorry I forgot to post that earlier.
