Passing a variable to flash

Hi,

I’m pretty new to AS3 and although I keep seeing the same solution all over the forums, I can’t seem to get my flash movie to work properly.

I’m trying to pass a parameter id from a URL to my movie…for example:
[COLOR=#336699]http://www.mysite.com/xmas_2111.swf?id=3[/COLOR]

Here is the AS code:

 
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();

var idString:String = root.loaderInfo.parameters.id;

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

xmlLoader.load(new URLRequest
   ("xmas.xml"));



function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseNames(xmlData);
}

function ParseNames(nameInput:XML):void {

var nameRecipient = nameInput.Recipient.(@id == idString).firstname;
firstname.text = nameRecipient;

var nameSender = nameInput.Recipient.(@id == idString).sender;
sender.text = nameSender;

var titleSender = nameInput.Recipient.(@id == idString).title;
jobtitle.text = titleSender;

}

And here is the html code where the flash movie is embedded:

<param name="movie" value="xmas_2111.swf" />
<param name="FlashVars" value="id=1" />
<param name="quality" value="high" />
<embed src="xmas_2111.swf" FlashVars="id=1" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="550" height="400"></embed>


 
If I comment out this line in the actionscript:

var idString:String = root.loaderInfo.parameters.id;



then replace it with a value like this:

var idString:String = “3”;



it reads the correct elements from my xml file as hoped!
I just can't seem to take the id value from the query string and pass it to the variable idString...so, so frustrating!
 
Any suggestions are most welcome.
Cheers,
W