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

Javascript 如何使用flash音乐播放器在母版页中添加自动播放音乐开始前的延迟,javascript,actionscript-3,flash,Javascript,Actionscript 3,Flash,当我访问我的网站中的每个页面时,我想增加几秒钟的延迟,我正在使用自动播放。 是否有任何参数可用于FlashVar,以便我可以在音乐开始前添加几秒钟的延迟,因为默认menter code hereusic每次访问新页面都会启动1或2秒 ` $(文档).ready(函数(){ var mp3snd=“/JSRDS/Content/mp3s/PPK_resurrection.mp3”; if((window.top.location.toString().toLowerCase().lastI

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

`



$(文档).ready(函数(){
var mp3snd=“/JSRDS/Content/mp3s/PPK_resurrection.mp3”;
if((window.top.location.toString().toLowerCase().lastIndexOf(“root/”)+6)==window.top.location.toString().toLowerCase().length){mp3snd=“PPK_reservation.mp3”;
}
else if(window.top.location.toString().toLowerCase().indexOf('page1.aspx')!=-1){
mp3snd=“PPK_resurction.mp3”;
}
else if(window.top.location.toString().toLowerCase().indexOf('page2.aspx')!=-1){
mp3snd=“gottawarshades\u intelligent.mp3”;
}
else if(window.top.location.toString().toLowerCase().indexOf('page3.aspx')!=-1){
mp3snd=“任务不可能的_Rhodium.mp3”;
}
else if(window.top.location.toString().toLowerCase().indexOf('page4.aspx')!=-1){
mp3snd=“Opportunities\u 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=“hawaifiveo_Media.mp3”;
}
else if(window.top.location.toString().toLowerCase().indexOf('page7.aspx')!=-1){
mp3snd=“SayYouSayMe\u Photos.mp3”;
}
else if(window.top.location.toString().toLowerCase().indexOf('page8.aspx')!=-1){
mp3snd=“TheLionSleepsTonight\u Shihara.mp3”;
}
else if(window.top.location.toString().toLowerCase().indexOf('page9.aspx')!=-1){
mp3snd=“ItsMyLife192vbr\u 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));
});

`

如果您可以控制swf(即拥有fla),则只需使用

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

stop();

setTimeout( playMovie, 1000 )

function playMovie() {

     play();
}
否则,在JS中,您可以使用&延迟将文件注入页面


setTimeOut已被弃用,Timer类将是一个更好的示例。很抱歉,我找不到任何AS3 setTimeOut()贬值的官方语句。但你是对的,定时器类将是一个更好的选择。
<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>
stop();

setTimeout( playMovie, 1000 )

function playMovie() {

     play();
}
setTimeout (injectSWF , 1000);

function injectSWF() { 

     swfobject.embedSWF("myMovie.swf", "ofc", "100%", "100%", "9.0.0"); 
}