停止/静音音频

时间:2012-06-18 15:52:59

标签: javascript jquery html flash audio

单击“iFrame”类的链接时,如何暂停以下音频对象?

<object type="application/x-shockwave-flash" data="../flash/player_mp3_maxi.swf" width="140" height="20">
<param name="wmode" value="transparent">
<param name="movie" value="../flash/player_mp3_maxi.swf">
<param name="FlashVars" value="configxml=../flash/config.xml&amp;mp3=../audio/intro/intro_08_background_07.mp3">
<p>Flash Audio Player</p>
</object>

我需要用javascript或jquery编写代码。

1 个答案:

答案 0 :(得分:2)

如果它是你自己的.swf并且你可以重新编译它,我会说你需要使用ExternalInterface公开玩家暂停方法。如果您之前没有这样做,请查看http://livedocs.adobe.com/flex/3/html/help.html?content=19_External_Interface_04.html

完成后,您只需向HTML链接添加一个事件监听器,并指定一个在用户点击时触发的功能。此函数调用外露的闪存功能暂停。

theLink.addEventListener("click", function(e){
    //call the exposed flash pause function
    swfObject.theExposedFunction();
});

有道理吗?