How to load multiple XML files and know when all loaded

How to load multiple XML files and know when all loaded

I load several XML files at the start of my AS code.
Using addEventlistener/Event.Complete for each URLloader I call upon functions to get data from the respective XML files.

Like this:

// Loads themes from XML file themes.xml
themeLoader.addEventListener(Event.COMPLETE, getThemes);
themeLoader.load(new URLRequest(“themes.xml”));

// Loads cats from XML file cats.xml
catloader.addEventListener(Event.COMPLETE, getCats);
catloader.load(new URLRequest(“cats.xml”));

function getThemes(e:Event):void
{
themes_xml = new XML(e.target.data);
themelist = themes_xml.theme;
N_themes = themelist.length();
MainShow();
}

function getCats(e:Event):void
{
cats_xml = new XML(e.target.data);
catlist = cats_xml.cat;
N_cats = catlist.length();
nextCat();
}

In those functions I call other functions to start my application.

The problem is that if some XML file (like cats.xml above) has not been loaded before I call MainShow(), I get errors since MainShow() also uses data from the cats.xml. Thus I would need to somehow wait for all my XML files to be loaded before I start up my application.

How can I do this in a convenient way?

please advice!

/jaxz