Pass XML string from PHP to Flash

Hi everyone, I’m hoping someone can help me out. I’ve been searching how to do this but haven’t got it to work yet.

All I want to do is have flash call my php page which is putting together an xml string as a variable. I want to take that xmlstring in flash and parse it into my array.

I know how to do everything except load that XML string and parse it. I know how to parse an xml file, but a string is new to me. Also, for some reason when I try to get the XML string from PHP it comes back undefined.

Here is my Flash Actionscript:
// Call PHP and load XML string
loadVariablesNum(“http://domain/recentimages.php","”);

//My PHP file spits out the string as $recentxml, and it works fine. But when I try to trace that same string in Flash I get undefined.

//Here is the loop I’ve created to wait until the xml has been generated.

if (recentxml == undefined){

gotoAndPlay(“loop”);

} else if (recentxml != undefined){

    gotoAndStop("finished");

}

//And here is the parsing method.
var myPhoto:XML = new XML();
myPhoto.parseXML(recentxml);
myPhoto.ignoreWhite = true;

Can anyone help? I would really appreciate any advice, I’ve been struggling with this for a while now and it’s probably something easy.

Thanks, Matt