Javascript and Flash

Hi,

I’m working on a site where I need to have a menu on all pages that when certain buttons are clicked loads the page with my swf and then tells the swf which frame to go to or to call a specific function.

I’ve managed to set this up to the point where I use a PHP session to get the variable and write it to the page as a JavaScript variable. I’ve also been able to get that variable into my flash file but I can’t get it to do anything in my functions.

Here’s my code:

var whereTo:String= ExternalInterface.call("getFlash");

setFrame(whereTo);

ExternalInterface.call("alert", whereTo); // confirm that the variable has been read in flash
	
function setFrame(where:String) {
	if (where=="frame1") {
		return;
	}
	if (where=="flyer") {
		loadFlyer();
	}
	if (where=="video") {
		loadVideo();
	}
	if (where=="links") {
		loadBrands();
	}
}

The external call out to the javascript alert pops up the right name for the variable so I assume that this means “whereTo” is set. If I manually set whereTo to a string (ie whereTo=“video”) the file works as expected. Does any one know what I might have missed here?

Thanks in advance for any help.