XML Help

I’m having problems accessing the xml data in my function. I usually separate the loading of the xml doc in a different function, but in the case I needed to include the loading in the same function. I’m not sure how to target the xml data. Any help would be greatly appreciated.

Code:


private function initContent(project:int):Sprite
{
	container = new Sprite();
	container.alpha = 0;
			
	loader = new URLLoader();
	request = new URLRequest("projects.xml");
			
	try {
		loader.load(request);
	} 
	catch (error:Error) {
	trace("Unable to load requested document."); 
	}			
			
	xml = new XML(loader.data);
	trace("xml", xml); //THIS TRACE EXPORTS NOTHING. THIS IS WHERE I NEED HELP.
	projectList = xml.project;

Thanks,
Yianni