I’ve written an html page that is using some javascript to hide and display a flash movie object. It all works fine until I try to exit from the tab, and when that happens the entire browser will crash with not so much as an error text box. Can anyone help? Thanks
Flash Code
if(ExternalInterface.available)
ExternalInterface.call('hideTimeline');
Javascript code
function showTimelineFirstPlay()
{
var timeline = document.createElement('span');
timeline.id = "timeLineer"
// WIDTH=1217 HEIGHT=170
//document.write(document.getElementById('topper').offsetHeight);
var fHeight = document.getElementById('topper').offsetHeight;
var fWidth = document.getElementById('topper').offsetWidth - 10;
var hHeight = fHeight + 100;
var hWidth = fWidth - 150;
timeline.innerHTML = "<OBJECT id='fTrans' allowScriptAccess='sameDomain' style = 'solid;border-color:#960000; border-width:3px;position:absolute; top:95; left:15;' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' WIDTH="+fWidth+" HEIGHT="+fHeight+"> <PARAM NAME=movie VALUE='FirstPlay.swf'> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#ffffff> </object><span onclick='hideTimeline()'style='color:#0098db;position:absolute; left:"+hWidth+"; top:"+hHeight+"'>- Hide Timeline</sapn>";
topper.appendChild(timeline);
}
function hideTimeline()
{
topper.removeChild(document.getElementById('timeLineer'));
}
window.onload = function()
{
showTimelineFirstPlay();
}
The plug in might be crashing because you are calling hideTimeline and removing the SWF when the SWF is waiting for a response.
Try starting a timer in hideTimeline that will removeChild after like 50