# How to Preload the XML file?

**URL:** <https://forum.kirupa.com/t/how-to-preload-the-xml-file/163865>\
**Category:** flash\
**Created:** [September 26, 2005, 9:56pm UTC](https://forum.kirupa.com/t/how-to-preload-the-xml-file/163865 "2005-09-26T21:56:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sw33tdesign](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@sw33tdesign](https://forum.kirupa.com/u/sw33tdesign)\
**Post date:** [September 26, 2005, 9:56pm UTC](https://forum.kirupa.com/t/how-to-preload-the-xml-file/163865/1 "2005-09-26T21:56:55Z")

</div>

Hello everybody! [/dr.nick] 😛

I have a Flash movie, and just made myself a preloader from the tutorial on this site.

```auto
onClipEvent (enterFrame) {
	var bytes = _root.getBytesTotal();
	var bytes_loaded = _root.getBytesLoaded();
	if (bytes_loaded == bytes) {
		_root.gotoAndPlay(2);
		this.mytxt = "movie loaded";
	} else {
		_root.gotoAndStop(1);
		this.mytxt = "loading (" + bytes_loaded + "/" + bytes +")";
		
	}
}

```

It loads and works great! But here’s the problem … I’m also using an XML file to generate the text in my movie. Can I combine the actionscript above to include loading my XML file, or what is the proper way to do that? Here is the code I’m using for the XML…

```auto
var mxml = new XML();
mxml.ignoreWhite = true;
mxml.onLoad = function(success) {
	if (success) {
		title1 = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
		text1 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
		title2 = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
		text2 = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
		var5 = "i am being called from var5";
	} 
};
mxml.load("myxml.xml");
title_txt.text = title1;
body_txt.text = text1;

```

Any help would be greatly appreciated 🙂
