WHAT I'M TRYING TO DO:
When the page loads, a Flash movie plays in a div.
When someone clicks on the movie, the movie plays a few more frames of
content and then calls a Javascript function that gets html content
and loads it into the same div as the flash was playing in, replacing
the flash content with html. This works in swfobject.js 1.5, but since
updating the code for swfobject 2.0 it no longer works.
Below is the actionscript, javascript and html.
________________________
ACTIONSCRIPT(3):
var url:String = "javascript:getIndex()";
var request:URLRequest = new URLRequest(url);
navigateToURL(request, "_self");
stop();
________________________
JAVASCRIPT (called as getindex.js in the html header):
function
fetchData()
} else if (window.ActiveXObject) {
try
{
pageRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
pageRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
pageRequest = false;
}
}
}
return pageRequest;
}
var request;
function getIndex()
{
request = fetchData();
request.onreadystatechange = sendData;
request.open("POST", "main_page_content.html", true);
request.send(null);
}
function sendData()
{
var dC = document.getElementById("flashcontent");
if(request.readyState == 4)
{
dC.innerHTML = request.responseText;
}
else if(request.readyState == 1)
{
dC.innerHTML = "<img src='images/loading.gif' /> Requesting
content..."
}
}
________________________
HTML CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<meta http-equiv="content-type" content="text/html;
charset=utf-8" />
<script type="text/javascript" src="include/js/
swfobject.js"></
script>
<script type="text/javascript" src="include/js/getindex.js"></
script>
<script type="text/javascript">
var flashvars = false;
var params = {};
params.menu = "false";
params.quality = "high";
params.wmode = "transparent";
params.AllowScriptAccess = "always";
var attributes = false;
swfobject.embedSWF("images/test.swf", "flashcontent",
"525", "525",
"9.0.0", "images/expressInstall.swf", flashvars, params, attributes);
</script>
<style type="text/css">
@import url(style/style1.css);
</style>
</head>
<body>
<div id="wrapper">
<div id="pagebody">
<div id="flashcontent">
<p><a href="
http://www.adobe.com/go/
getflashplayer"><img
src="
http://www.adobe.com/images/shared/download_buttons/
get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
</div>
</div>
</div>
</body>
</html>
Any advise is appreciated!