如何在使用flash音乐播放器的母版页中启动自动播放音乐之前添加延迟

时间:2012-07-27 04:49:46

标签: javascript actionscript-3 flash

当我访问我网站中的每个页面时,我想添加几秒钟的延迟我正在使用自动播放。 是否有任何参数可以与flashvars一起使用,以便我可以在音乐开始之前添加几秒钟的延迟,因为默认m enter code here usic每次访问新页面时都会启动1或2秒。

<<>>`

<object type="application/x-shockwave-flash" wmode="transparent" data="player_mp3_maxi.swf" width="65" height="20">
<param name="movie" value="player_mp3_maxi.swf" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
<param name="FlashVars" value="mp3=dummy.mp3&amp;width=65&amp;loop=0&amp;autoplay=1&  amp;volume=60&amp;showvolume=1&amp;showslider=0&amp;showloading=always&amp;buttonwidth=30&amp;volumeheight=8&amp;" />
</object>

&LT;&LT;&GT;&GT;

<script type="text/javascript">
$(document).ready(function () {
var mp3snd = "/JSRDS/Content/mp3s/PPK_Resurection.mp3";
if ((window.top.location.toString().toLowerCase().lastIndexOf("root/") + 6) ==         window.top.location.toString().toLowerCase().length) {mp3snd = "PPK_Resurection.mp3";
}
else if (window.top.location.toString().toLowerCase().indexOf('page1.aspx') != -1) {
 mp3snd = "PPK_Resurection.mp3";
}
else if (window.top.location.toString().toLowerCase().indexOf('page2.aspx') != -1) {
mp3snd = "GottaWearShades_Intellect.mp3";
}
else if (window.top.location.toString().toLowerCase().indexOf('page3.aspx') != -1) {
mp3snd = "MissionImpossible_Rhodium.mp3";
}
        else if (window.top.location.toString().toLowerCase().indexOf('page4.aspx') != -1) {
            mp3snd = "Opportunities_Projects.mp3";
        }
        else if (window.top.location.toString().toLowerCase().indexOf('page5.aspx') != -1) {
            mp3snd = "";
        }
        else if (window.top.location.toString().toLowerCase().indexOf('page6.aspx') != -1) {
            mp3snd = "HawaiiFiveO_Media.mp3";
        }
        else if (window.top.location.toString().toLowerCase().indexOf('page7.aspx') != -1) {
            mp3snd = "SayYouSayMe_Photos.mp3";
        }
        else if (window.top.location.toString().toLowerCase().indexOf('page8.aspx') != -1) {
            mp3snd = "TheLionSleepsTonight_Shihara.mp3";
        }
        else if (window.top.location.toString().toLowerCase().indexOf('page9.aspx') != -1) {
            mp3snd = "ItsMyLife192vbr_History.mp3";
        }
        else if (window.top.location.toString().toLowerCase().indexOf('page10.aspx') != -1) {
            mp3snd = "";
        }
        else if (window.top.location.toString().toLowerCase().indexOf('page11.aspx') != -1) {
            mp3snd = "";
        }
        else if (window.top.location.toString().toLowerCase().indexOf('page12.aspx') != -1) {
            mp3snd = "";
        }

        $(".volumeControl").html($(".volumeControl").html().replace("dummy.mp3", mp3snd));
    });
</script>

`

1 个答案:

答案 0 :(得分:0)

如果您可以控制swf(即有fla),那么只需使用setTimeout

然后可以通过在flashvars中传递参数来控制逻辑。

stop();

setTimeout( playMovie, 1000 )

function playMovie() {

     play();
}

在JS中,您可以使用swfobject&amp;延迟将文件注入页面。 setTimeout

setTimeout (injectSWF , 1000);

function injectSWF() { 

     swfobject.embedSWF("myMovie.swf", "ofc", "100%", "100%", "9.0.0"); 
}
相关问题