0
다음 코드를 사용 중입니다. 그것은 getElementByID와 함께 잘 작동하지만 OS 감지 기능을 사용하면 작동이 멈 춥니 다. 라인 아래 어떤 아이디어를 작동 반면플래시/자바 스크립트 통신 오류
function getFlashMovie(movieName)
{
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
getFlashMovie('myId').sendToActionsript(str);
은 위의 코드는 작동하지 않는 이유는 무엇입니까?
document.getElementById('myId').sendToActionscript(str);
EDIT : 동일하지 않은 또 다른 코드 조각입니다.
function getFlashMovieSecond(movieName)
{
if (window.document[movieName])
{
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}
도움과 함께 제공되는 예 (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external를 사용해보십시오 작동하는 것 같다 /ExternalInterface.html#includeExamplesSummary) - 필요없는 비트를 점차 제거하고 프로젝트에 코드를 통합합니다. 일부 브라우저는 embed 태그를 사용하여 Flash 내용을 얻는 반면, 다른 브라우저는 object 태그를 사용하므로 일부 태그에 동일한 이름/ID가 있는지 확인하고 AllowScriptAccess는 항상 " ". HTH –