2011-09-14 2 views
2

플래시 동영상 객체를 숨기고 표시하는 데 JavaScript를 사용하는 html 페이지를 작성했습니다. 탭에서 나가기 전까지는 모두 제대로 작동하며, 오류가 발생하면 전체 브라우저가 오류 텍스트 상자와 충돌하지 않게됩니다. 누구든지 도와 줄 수 있습니까? 감사합니다as3 ExternalInterface.call이 브라우저 충돌을 야기합니다.

플래시 코드

if(ExternalInterface.available) 
ExternalInterface.call('hideTimeline'); 

자바 스크립트 코드

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

가 다시 부팅하려고있었습니다에서 removeChild 것 hideTimeline에서 타이머를 시작하려고? 스크립트는 브라우저를 손상시키지 않아야합니다. 문제가 무엇인지 코드 게시에 오류가있는 경우/ –

+0

그건 그게 무슨 문제인지 정확히 모르겠습니다. actionscript가 ExternalInterface.call을 사용하여 Javascript 메서드를 호출하면 오류가 발생한다는 것을 알고 있습니다. 해당 호출이 이루어진 후에 탭을 닫으려고하면 브라우저가 충돌하지만 오류 메시지는 표시되지 않습니다. –

+0

hideTimeline을 호출하고 SWF가 응답을 기다리고있을 때 SWF를 제거하기 때문에 플러그인이 손상되었을 수 있습니다. hideTimeline에서 타이머를 시작하면 topper.removeChild (document.getElementById ('timeLineer')); 타이머가 시작됩니다. 012 밀리 초 후에 같은 . –

답변

0

는 SWF가 응답 될 때까지 대기하는 경우에 당신이 hideTimeline를 호출하고 SWF를 제거하기 때문에 충돌 될 수있는 플러그.
같은 50

miliseconds.topper.removeChild(document.getElementById('timeLineer')); 
관련 문제