# How do I preload multiple XML files?

**URL:** <https://forum.kirupa.com/t/how-do-i-preload-multiple-xml-files/186758>\
**Category:** flash\
**Created:** [April 24, 2006, 12:11pm UTC](https://forum.kirupa.com/t/how-do-i-preload-multiple-xml-files/186758 "2006-04-24T12:11:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rasper](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@Rasper](https://forum.kirupa.com/u/Rasper)\
**Post date:** [April 24, 2006, 12:11pm UTC](https://forum.kirupa.com/t/how-do-i-preload-multiple-xml-files/186758/1 "2006-04-24T12:11:50Z")

</div>

Hi there

I want to preload multiple XML files using the XML.load method.  
I know how to do this for one XML file, but I’m interested in preloading multiple XML files (My data + config settings).

How would one do this?  
I thought of 2 ways, but I don’t think they’re very nice programming:

1. Preload the first XML and do another XML.load within the XML.onload. But that way, you get a lot of nested functions if you want to preload more than 2 files.
2. Preload both the XML files at the same time, and use a counter to check if all the XML.onload are executed.

Are there other ways?

---

<div class="post-metadata">

**Author:** ![bootiteq](https://avatars.discourse-cdn.com/v4/letter/b/eb9ed0/32.png) [@bootiteq](https://forum.kirupa.com/u/bootiteq)\
**Post date:** [April 24, 2006, 12:28pm UTC](https://forum.kirupa.com/t/how-do-i-preload-multiple-xml-files/186758/2 "2006-04-24T12:28:32Z")

</div>

check the source and experiments section for this

> **[XML to object class - any xml tree](https://www.kirupa.com/forum/showthread.php?t=215842)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

creatify has made something pretty ■■■■ cool i think.

Otherwize, like you said, load multiple xml files into seperate var’s and access when needed.

---

<div class="post-metadata">

**Author:** ![Rasper](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@Rasper](https://forum.kirupa.com/u/Rasper)\
**Post date:** [April 24, 2006, 1:31pm UTC](https://forum.kirupa.com/t/how-do-i-preload-multiple-xml-files/186758/3 "2006-04-24T13:31:57Z")

</div>

Looks cool, thanks.

After a search I found a nice way of preloading the xml by going through an array of the xml files. When it’s completed you have to do the same thing once again, but the xml file will be cached on the user’s computer.

---

<div class="post-metadata">

**Author:** ![kenyabob](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@kenyabob](https://forum.kirupa.com/u/kenyabob)\
**Post date:** [July 8, 2008, 12:09am UTC](https://forum.kirupa.com/t/how-do-i-preload-multiple-xml-files/186758/4 "2008-07-08T00:09:45Z")

</div>

Could you be more specific about the exact solution you found? I am having the same problem, and unfortunately, every time I try to load multiple xml files the whole server crashes saying too many mysql connections (the XML files are created dynamically).
