2012-01-11 28 views
1

在下面的代碼中有閃光燈中的按鈕,我試圖讓它通過html按鈕訪問。所以當記錄按鈕被按下時,模式將被「記錄」並調用record_functions()。我能夠在Firefox上工作,但在Internet Explorer中按鈕似乎不起作用,即無法從Internet Explorer調用閃光燈功能。請讓我知道如何解決這個問題獲取IE對象來控制Flash按鈕

function thisMovie(movieName) 
{ 
if (window.document[movieName]) 
    { 
    return document.getElementById(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); 
    } 
    } 


function record_functions(mode) 
{ 
    if(mode == "record") 
    { 

    thisMovie("audiorecoding").startRecording(); 
    } 
    else if(mode == "stop") 
    { 
    thisMovie("audiorecoding").stopRecording(); 
    } 
    else if(mode == "play") 
    { 
     thisMovie("audiorecoding").playRecording(); 
    } 
    else if(mode == "pause") 
    { 
     thisMovie("audiorecoding").pauseRecording(); 
    } 
} 

<input type="button" onclick="record_functions('record')" value="Record" /> 

回答

0

你應該把你的瑞士法郎由id屬性在IE上,但在其他瀏覽器的name attirbute。

if (navigator.appName.indexOf("Microsoft") == -1) 
    swfObject = document["mozillaEmbedName"]; 
else 
    swfObject = window["ieObjectID"]; 
+0

是上述正確或window.document [的movieName];而對於具有相同problem.classid任何其他用戶的說明必須包括在對象標籤否則SWF將無法從HTML按鈕訪問我使用過window.document [movieName];並且對我來說工作正常 – Rajeev 2012-01-12 12:58:08

+0

是的,窗口[「ieObjectID」]和window.document [「ieObjectID」]變體都可以工作。我的變體用於Adobe的幫助。我犯了錯。我混合IE和Mozilla。但目前的版本是正確的。 – 2012-01-12 19:37:37

+0

k謝謝你...... – Rajeev 2012-01-13 05:51:14

0

你沒有指定你的錯誤,如果它是一個引用錯誤(找不到閃光燈)

我建議使用SWFObject將返回參考你的對象,看看這個:http://code.google.com/p/swfobject/