2012-04-12 50 views
0

我在下面的代碼中遇到了一些麻煩。 Flash播放器有一個默認音量滑塊,但我想使用jQuery滑塊來改變音量。當我移動滑塊時,音量值(nr)正在改變,但歌曲的音量不變。如何使用jQuery滑塊更新Flash播放器的歌曲音量?

thx爲您的輸入。

<!DOCTYPE html> 
<script type='text/javascript'> 
$(document).ready(function(){ 

DefVol=$('#ArVol').val(); 

PlayPt1='<object type="application/x-shockwave-flash" data="http://flash-mp3- player.net/medias/player_mp3_maxi.swf" width="25" height="25"><param name="movie" value="http://flash-mp3-player.net/medias/player_mp3_maxi.swf" /><param name="FlashVars" value="mp3=' 


PlayPt2='&amp;showslider=0&amp;width=25&amp;autoplay=1&amp;volume='+DefVol+'" /> </object>' 



$("#RegVol").slider({orientation:'horizontal', range:'min', value:DefVol,min:0, max:200, slide:function(event,ui){DefVol=parseInt(ui.value/200), $("#ArVol").val(ui.value);} 

}) 
$("#ArVol").val($("#RegVol").slider("value")); 

$('#PlayMp3').click(function(){ 
IaSrc='song.mp3' 

$('#showPlay').html(PlayPt1+IaSrc+PlayPt2) 
}) 
}) 
</script> 
<table><tr> 
<th><div id='RegVol' style='width:150px;margin:0px 10px'></div></th> 
<th><input id='ArVol' size='1' value='55'></th> 
<th><div id='showPlay'></th> 
</tr></table> 

<input type='button' value='Play' id='PlayMp3'> 

回答

1

您是否有權訪問Flash源或源是否公開外部接口? 如果不是,不要打擾你嘗試。

編輯:只要檢查您所使用的播放器的文檔,我花了5秒:能

http://flash-mp3-player.net/players/js/documentation/

+0

我也檢查了球員的文檔。它提供了這個選項:document.getElementById(「myFlash」)。SetVariable(「player:jsVolume」,「50」); 但我找不到實現它的方法。 – ChrisGP 2012-04-13 16:27:02

相關問題