Passing variables from Flash to PHP?


Ive, just finished the excellent Photo Gallery using XML and Flash tutorial.
I am having a problem implementing it into my site though.

I have a projects page which is dynamically generated using php mysql. I want to have just one photogallery flash file on this page which dynamically draws in the correct images for any given project.

At the moment Im half way there. So far I have passed a variable (the ID of a project ) to the flash movie using the following code in the HTML:
<object type=“application/x-shockwave-flash” data=“gallery.swf” height=“400” width=“300”>
<param name=“movie” value=“gallery.swf” />
<param name=“FlashVars” VALUE="[COLOR=Red]<?php echo $projectid ?>[/COLOR]">
I want Flash to then pass this variable to a php file that will then produce the correct xml for the flash file.

Basically what I want it to do in the AS is this:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;

the php file will then output correct xml for that project

Im not sure how the passing of the variable is done in this instance.
Can anyone help?