javascript - as3 ExternalInterface.call 导致浏览器崩溃

标签 javascript html actionscript-3

我写了一个 html 页面,它使用一些 javascript 来隐藏和显示 flash 电影对象。一切正常,直到我尝试退出选项卡,当发生这种情况时,整个浏览器将崩溃,连错误文本框都没有。谁能帮忙?谢谢

闪码

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();
}

最佳答案

插件可能会崩溃,因为您正在调用 hideTimeline 并在 SWF 等待响应时删除 SWF。
尝试在 hideTimeline 中启动一个计时器,它会在 50 秒后移除 Child

miliseconds.topper.removeChild(document.getElementById('timeLineer'));

关于javascript - as3 ExternalInterface.call 导致浏览器崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7422219/

相关文章:

javascript - 如何进一步扩展扩展 Javascript 类模块的状态

javascript - 使用 CasperJS 单击表中的链接

javascript - 如何处理来自服务器的空 json 响应

css - 如何在 flex 元素中垂直居中文本?

javascript - UIWebView 不加载外部 JavaScript 文件

php - 不可能用 html 解析 facebook 公共(public)配置文件

actionscript-3 - ActionScript 3 示例(仅限代码)

javascript - 我可以检查什么来确保 Angular 已完成加载并可以使用

javascript - 如何在新窗口中打开 Flash 内容内的链接按钮

actionscript-3 - 如何无缝循环FLV