Xml blues

I’ve made this dynamic thing where a bunch of xml is loaded from a php file…


gallery = new XML();
gallery.load("loadPics.php");
gallery.onLoad = function(success) {
	if (success) {
		makeHierarchy();
	} else {
	}
};

Well it works and stuff
In the function “makeHierarchy” I have a line that counts the number of one of the childnodes.

catcount = gallery.childNodes[0].childNodes.length;

and then I have a for loop that duplicates movieclips. I want that for loop to run as many times as the catcount is. (so basically for(c=0;c<=catcount;c++))
It works when I test it in my browser window but when I run it in flash it gets really slow and prompts me to abort the script.
This is because the catcount is infinity or sumthin’ well anyway the “Success” in my onLoad() is true and it triggers the function although there is no xml loaded.
edit: I guess it’s bcuz catcount is “undefined” and any text is equal to infinity…

I hope you get it…
Is there a way to fix this problem? :sigh: