# Closing loadXML in flash mx 2004

**URL:** <https://forum.kirupa.com/t/closing-loadxml-in-flash-mx-2004/233523>\
**Category:** Uncategorized\
**Created:** [July 24, 2007, 5:33pm UTC](https://forum.kirupa.com/t/closing-loadxml-in-flash-mx-2004/233523 "2007-07-24T17:33:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluecarnumber9](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bluecarnumber9](https://forum.kirupa.com/u/bluecarnumber9)\
**Post date:** [July 24, 2007, 5:33pm UTC](https://forum.kirupa.com/t/closing-loadxml-in-flash-mx-2004/233523/1 "2007-07-24T17:33:30Z")

</div>

I didn’t seem to need to close the dynamically loaded thumbnails until I added the javascript for SWFObject. Now when I click on of the navigation buttons to go to another page it leaves the thumbnails on top of the next page. What is the best way to fix this? Is there a way to add something to the nav buttons to close the xml or to clear it or is there a better way entirely? :hr:

Here is the loadXML actionscript:

function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
description = [];  
thumbnails = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
description\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
thumbnails\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;  
}  
sload();  
firstImage();  
} else {  
content = “file not loaded!”;  
}  
}  
this.createEmptyMovieClip(“kk”, 1029);  
kk.\_x = 140.9;  
kk.\_y = kk.starty=200.9;  
kk.setMask(mm)  
btn.enabled = false  
function drawSquare(clip, depth, colour, x, y, w, h) {  
var mc = clip.createEmptyMovieClip(“clip”+depth, depth);  
mc.\_x = x;  
mc.\_y = y;  
mc.lineStyle(lineWidth, color, 0);  
mc.beginFill(0x000000);  
mc.lineTo(w, 0);  
mc.lineTo(w, h);  
mc.lineTo(0, h);  
mc.endFill();  
return mc;  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“image.xml”);

and the java from SWFobject:  
(in header): \<script type=“text/javascript” src=“js/swfobject.js”\>\</script\>

(in body):  
\<div id=“flashcontent”\>  
&nbsp;  
\</div\>  
\<script type=“text/javascript”\>  
var so = new SWFObject(“movie.swf”, “content”, “800”, “600”, “6”, “#000000”);  
so.write(“flashcontent”);  
\</script\>
