Passing flash variables between flash files using jquery and fancybox

How to use an embeded pass variables between flash files using the jquery pluging fancy box.

In this example we need to select a continent of the world to then load a larger flash file which is then zoomed into this area.

continent

worldselected

View example

The first part is to send your variable(s) to the containing page

function raiseClick(e:MouseEvent):void
{
	var stClicked:String;
	stClicked=e.currentTarget.name.toString()
			if(ExternalInterface.available) {
						ExternalInterface.call("showFancyBox", stClicked);
			}
}

The above code then passes the string stClicked to the page calling the fancyBox overlay

<script type="text/javascript">
// showFancyBox function called by flash
function showFancyBox(my_href) 
{
	// instantiate fancybox
	$(document).ready(function() {
		$("a.flashOver").fancybox({
			'padding'			: 3,
			'overlayOpacity'	: 0.8,
			'overlayColor'		: '#000',
			'width'				: 700,
			'height'			: 365,
			'content'			: '<div id="flashOverlay">Add Alt content for overlay.swf here.</div>',
			'autoDimensions'	: false,
			'scrolling'			: 'no',
			'hideOnContentClick': false
		});
	});
	
	// trigger click
	$('#inline').trigger('click');
	alert("toast")
	// embed swf on flashOverlay div
	var flashvars = {
		path: my_href
	}
	swfobject.embedSWF("worldmap.swf", "flashOverlay", "700", "365", "10", "./swf/expressInstall.swf", flashvars, params, {id:"swfOverlay"});
}

</script>

In the called flash file you can then access the passed variable by using the flashVarData, in the example below i fiurst check if there is a value and then assign a default value if nothing was passed

if(flashVarData["path"] == undefined) {
				flashVarData = {
					path: "conEurope"
				};
			}
			stContinent=flashVarData.path;