Hi, I am creating a Flash website. Inside the main swf file is a movie clip with an instance name of ‘fadeanimation’. I’d like for this movie clip to play when the window comes into focus. The window loses it’s focus when the site launches a pop up window (yes I’m using popups). The user may choose to leave the popup window open when returning back to the main site so I don’t want to attach the script specifically to the action of closing the popup window. I’d like for the script to instead be attached to the main website window coming back into focus.
Here is a trimmed down version of the html code I’m using:
<html>
<head>
<script src=“Scripts/swfobject_modified.js” type=“text/javascript”></script>
<script language=“JavaScript”>
function getFlashMovieObject(movieName)
{
if (window.document[movieName])
{
return window.document[movieName];
}
if (navigator.appName.indexOf(“Microsoft Internet”)==-1)
{
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf(“Microsoft Internet”)!=-1)
{
return document.getElementById(movieName);
}
}
function myFadeBack()
{
var flashMovie=getFlashMovieObject(“FlashID”);
flashMovie.TPlay("_level0.fadeanimation");
}
</script>
</head>
<body onFocus=myFadeBack();>
</body>
</html>
As you can see, I’m using onFocus to achieve this effect and it works perfectly in Safari and Firefox but not Internet Explorer. What I’d like to know is what I need to do to get this working across all 3 browsers. Have I done anything wrong with the code above? Should I be doing this some other way?
Here is a link of the site i action (not working in IE)
http://www.lukeheise.com/test5/
and here are the source files:
http://www.lukeheise.com/test5/flash_files.zip
Help would be appreciated!
Thanks.