2013-01-16 60 views
0

請幫忙!我不是最經驗豐富的編碼器,我正在爲我的Soundmanager Inline mp3製作一個手動停止按鈕。我嘗試了很多東西,但無法弄清楚如何訪問inlineplayer.js來呼叫停止。Soundmanager內聯播放器呼叫停止

我使用此代碼我的網頁上一個div內:

<link rel="stylesheet" type="text/css" href="http://www.synapseunrest.com/soundmanager/demo/play-mp3-links/css/inlineplayer.css" /> 
    <link rel="stylesheet" type="text/css" href="http://www.synapseunrest.com/soundmanager/demo/flashblock/flashblock.css" /> 
    <script type="text/javascript" src="http://www.synapseunrest.com/soundmanager/script/soundmanager2.js"> </script> 
    <script type="text/javascript" src="http://www.synapseunrest.com/soundmanager/demo/play-mp3-links/script/inlineplayer.js" > </script> 



<div id="sm2-container"> 
    <!-- SM2 flash goes here --> 
</div> 


<ul class="graphic"> 
    <li><a href="mp3/Centre for Indigenous Theatre.mp3">Centre for Indigenous Theatre</a></li> 
    <li><a href="mp3/Fallen Angel.mp3">Fallen Angel</a></li> 
    <li><a href="mp3/D'bi Young.mp3">D'bi Young</a></li> 
    <li><a href="mp3/Haircuts.mp3">Haircuts By Kids</a></li> 
    <li><a href="mp3/Hamlet.mp3">Hamlet</a></li> 
    <li><a href="mp3/Kudelka.mp3">Kudelka</a></li> 
    <li><a href="mp3/Lost Lyrics.mp3">Lost Lyrics</a></li> 
    <li><a href="mp3/Next Sex.mp3">Next Sex</a></li> 
    <li><a href="mp3/R Murray Shafer.mp3">R Murray Shaffer</a></li> 
    <li><a href="mp3/Sarajevo.mp3">Sarajevo</a></li> 
    <li><a href="mp3/Tallis Choir.mp3">Tallis Choir</a></li> 
    <li><a href="mp3/Tallis.mp3" id="sound">Tallis</a></li> 
    <li><a href="mp3/TDT Hidden Cameras.mp3" id="sound">TDT & the Hidden Cameras</a></li> 
    <li><a href="mp3/The Real McCoy.mp3" id="sound">The Real McCoy</a></li> 
    <li><a href="mp3/Final Fantasy.mp3" id="sound">Final Fantasy</a></li> 

    </ul> 

最後我想,當我隱藏包含div停止這個球員。我無法弄清楚如何從我的主頁中調用其他文檔(inlineplayer.js)中的javascript。我正在尋找像soundmanager.stopSound()這樣的東西,我可以將其添加到我的show/hide div動作中,或者甚至只是製作一個STOP按鈕,它將殺死來自此播放器的所有聲音。

我基於此模板的這個球員:​​

我有一種感覺,我應該在這裏呼籲:http://www.synapseunrest.com/soundmanager/demo/play-mp3-links/script/inlineplayer.js

但我不知道該怎麼做! 請幫忙!

回答

0

因爲你嵌入「inlineplayer.js」應該有一個名爲「inlinePlayer」在全球範圍內一個JavaScript對象。你可以用你的隱藏-DIV功能線:

inlinePlayer.stopSound(inlinePlayer.lastSound); 

,甚至更好 - 檢查對象存在,如果聲音已播放:

if(inlinePlayer){ 
    if(inlinePlayer.lastSound){ 
     inlinePlayer.stopSound(inlinePlayer.lastSound); 
    } 
}