windows.onload event
I'm embedding a flash object in an html page and calling windows.onload to initialize the Flash movie. The problem is that the windows.onload does not wait for the Flash object to completely load. Is there way to make sure that the Flash object has fully loaded? Here is the code I'm using:
<head>
<script>
var falshObj = null;
function pageInit()
{
thisMovie();
//alert("test");
falshObj.init();// function within the Flash Object
}
function thisMovie()
{
if (navigator.appName.indexOf("Microsoft") 开发者_Go百科!= -1)
{
falshObj = window["main"];//Flash object name
}
else
{
falshObj = document["main"];//Flash object name
}
}
</script>
</head>
<body >
<script>
if (window.addEventListener)
{
window.addEventListener("load", pageInit, false);
}
else
{
window.attachEvent("onload", pageInit);
}
</script>
</body>
</html>
Thanks
Flash is totally async to the rest of the browser. You'd need to utilize an externalInterface call back to the JavaScript in order to notify it that the movie has loaded.
Also, your JS syntax is antiquated and error prone, but that's a different discussion.
精彩评论