2
我写了一个HTML页面,使用一些JavaScript隐藏和显示Flash电影对象。这一切都正常工作,直到我试图退出选项卡,当发生这种情况时,整个浏览器将崩溃,而不是一个错误文本框。谁能帮忙?由于as3 ExternalInterface.call导致浏览器崩溃
闪存代码
if(ExternalInterface.available)
ExternalInterface.call('hideTimeline');
Javascript代码
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();
}
你尝试重新启动,这将removeChild之?脚本不应该使浏览器崩溃。如果这是错误的代码发布问题是/是 –
这只是它,我不确定问题究竟是什么。我知道当动作使用ExternalInterface.call调用Javascript方法时,会导致一些错误。当您尝试在调用完成后关闭该选项卡时,它会使浏览器崩溃,但不会显示错误消息。 –
插件可能会崩溃,因为您在调用hideTimeline并在SWF等待响应时删除SWF。尝试在hideTimeline中启动一个计时器,将topper.removeChild(document.getElementById('timeLineer'));经过50毫秒之后。 –