【问题标题】:How to add delay before autoplay music starts in master page with flash music player如何在使用 Flash 音乐播放器在母版页中开始自动播放音乐之前添加延迟
【发布时间】:2012-07-27 04:49:45
【问题描述】:

当我访问我网站中使用自动播放的每个页面时,我想添加几秒钟的延迟。 是否有任何参数可以与 flashvars 一起使用,以便我可以在音乐开始前添加几秒钟的延迟,因为默认 menter code hereusic 每次访问新页面时都会启动 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>

>

<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>

`

【问题讨论】:

    标签: javascript actionscript-3 flash


    【解决方案1】:

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

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

    stop();
    
    setTimeout( playMovie, 1000 )
    
    function playMovie() {
    
         play();
    }
    

    在 JS 中,您可以使用 swfobjectsetTimeout 延迟将文件注入页面。

    setTimeout (injectSWF , 1000);
    
    function injectSWF() { 
    
         swfobject.embedSWF("myMovie.swf", "ofc", "100%", "100%", "9.0.0"); 
    }
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多