# XML Gallery in External SWF

**URL:** <https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422>\
**Category:** Uncategorized\
**Created:** [May 27, 2008, 2:36pm UTC](https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422 "2008-05-27T14:36:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmparchitects](https://avatars.discourse-cdn.com/v4/letter/l/9de053/32.png) [@lmparchitects](https://forum.kirupa.com/u/lmparchitects)\
**Post date:** [May 27, 2008, 2:36pm UTC](https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422/1 "2008-05-27T14:36:27Z")

</div>

Hi all,

I have been using the modified version of Kirupa’s XML Gallery as posted by ‘Scotty’ in post 19 of this thread…

> **[XML Image Gallery w/ Crossfades? - Page 2](https://www.kirupa.com/forum/showthread.php?t=212112&highlight=xml+slideshow&page=2)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

…I am hosting the gallery externally, and loading it using ‘loadMovie’ into an empty movieclip.

Index.swf \> Home.swf \> Homeslideshow.swf

I have got the slideshow edited to suit my needs, and it loads perfectly upon first arriving at the home page.

However, the problem occurs when I have been on another page (which is another external swf - lets say 'Index.swf \> About.swf) and then returned to the home page (and its slideshow).

The images do not seem to show up, however I can see the load bar and the captions loading fine. On the other hand, sometimes I find the images load, but almost as if the Swf has loaded itself again behind the one previously loaded.

There is obviously something (probably minor!) messing up, so please find attached my source files.

If anyone can resolve this issue it would be fantastic, and hopefully helpful to others who search the forum 🙂

Thank you in advance for any help - it will be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![lmparchitects](https://avatars.discourse-cdn.com/v4/letter/l/9de053/32.png) [@lmparchitects](https://forum.kirupa.com/u/lmparchitects)\
**Post date:** [May 28, 2008, 7:44am UTC](https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422/2 "2008-05-28T07:44:50Z")

</div>

Apologies for the bump - can anyone help out?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![lmparchitects](https://avatars.discourse-cdn.com/v4/letter/l/9de053/32.png) [@lmparchitects](https://forum.kirupa.com/u/lmparchitects)\
**Post date:** [May 28, 2008, 1:55pm UTC](https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422/3 "2008-05-28T13:55:00Z")

</div>

Well, after searching around I decided to test out an alternative open source cross fade slideshow, to test it out…

[http://whatdoiknow.org/archives/001629.shtml](http://whatdoiknow.org/archives/001629.shtml)

…I’ve had the same findings - upon the first load (index.swf \> home.swf \> homeslideshow.swf) the slideshow works fine, it is only after returning to the ‘home.swf’ after visiting another external swf that I have problems.

Is it the code i am using to load in the secondary external swf? I tried the action script directly onto the home.swf and the same occured.

☹

---

<div class="post-metadata">

**Author:** ![sparkdemon](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sparkdemon](https://forum.kirupa.com/u/sparkdemon)\
**Post date:** [May 28, 2008, 6:29pm UTC](https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422/4 "2008-05-28T18:29:24Z")

</div>

explain yourself… piece by piece…

lets understand the problem in detail

---

<div class="post-metadata">

**Author:** ![joselete](https://avatars.discourse-cdn.com/v4/letter/j/e495f1/32.png) [@joselete](https://forum.kirupa.com/u/joselete)\
**Post date:** [June 24, 2008, 12:44pm UTC](https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422/5 "2008-06-24T12:44:13Z")

</div>

Hi, I have the same problem in my slide show. it looks like the problem is that the interval has not been clear so every time i come back to the slide show the pictures keep looking on top of each other.  
i dont know how to solve the problem !!!  
Does anyone know how to do it?

this is the code.

var id, current;  
var k = 0, p = 0;  
var slide = 1;  
function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
description = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
description\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
}  
id = setInterval(preloadPic, 100);  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“images/galeria/slides/galeria.xml”);  
function preloadPic() {  
clearInterval(id);  
var con = picture.duplicateMovieClip(“con”+k, 9984+k);  
con.loadMovie(image[p]);  
preloader.\_visible = 1;  
preloader.swapDepths(con.getDepth()+3);  
con.\_alpha = 0;  
var temp = \_root.createEmptyMovieClip(“temp”+k, 99+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;  
if (slide) {  
id = setInterval(nextImage, 5000);  
}  
delete this.onEnterFrame;  
}  
};  
}  
MovieClip.prototype.fadeIn = function() {  
if (this.\_alpha\<100) {  
current.\_alpha -= 4;  
this.\_alpha += 4;  
} else {  
current.\_visible = 0;  
current = this;  
delete this.onEnterFrame;  
}  
};  
function nextImage() {  
p\<total-1 ? p++ : p=0;  
desc\_txt.text = description[p];  
picture\_num();  
preloadPic();  
}

preloadPic();

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 24, 2008, 12:47pm UTC](https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422/6 "2008-06-24T12:47:02Z")

</div>

how are you navigating between pages?

visuals: fla or a picture?

---

<div class="post-metadata">

**Author:** ![joselete](https://avatars.discourse-cdn.com/v4/letter/j/e495f1/32.png) [@joselete](https://forum.kirupa.com/u/joselete)\
**Post date:** [June 24, 2008, 1:49pm UTC](https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422/7 "2008-06-24T13:49:52Z")

</div>

i have a menu and a loader in the main movie (main.swf ) when i click to see the slide show in the menu the movie (slideshow.swf) is loaded into the loader in the main.swf all the other movies like contact.swf and info.swf there are all loaded into the main.swf The slide show are jpgs.

---

<div class="post-metadata">

**Author:** ![pappageo](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pappageo](https://forum.kirupa.com/u/pappageo)\
**Post date:** [July 11, 2008, 1:43am UTC](https://forum.kirupa.com/t/xml-gallery-in-external-swf/261422/8 "2008-07-11T01:43:32Z")

</div>

I have the same problem, has anyone been able to find a fix?
