Passing a variable to flash


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:

Here is the AS code:

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

var idString:String =;

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

xmlLoader.load(new URLRequest

function LoadXML(e:Event):void {
xmlData = new XML(;

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="" type="application/x-shockwave-flash" width="550" height="400"></embed>

If I comment out this line in the actionscript:

var idString:String =;

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, so frustrating!
Any suggestions are most welcome.