Krpano音樂控制按鈕:實現對音樂的播放、暫停、關閉的控制

1.引入KRpano soundinterface插件

<plugin name="soundinterface"
                    url="%SWFPATH%/plugins/soundinterface.swf"
                    alturl="%SWFPATH%/plugins/soundinterface.js"
                    rootpath="%SWFPATH%/sound/ChinaP.mp3"
                    preload="true"
                    keep="true"
                    volume="0.6"
                    />

2.events加入音樂文件
    

    <!-- start playing the sound -->
            <events name="currentpano"
                    keep="true"
                    onnewpano="playsound(bggsnd, '%SWFPATH%/sound/ChinaP.mp3', 0);"
                    onremovepano="stopsound(bgsnd);"
                    />

3.加入音樂控制按鈕

<layer name="music" url="sound/soundonoff.png" scale="0.5" crop="0|0|50|50" zorder="999" keep="true" alpha="1" visible="true" x="5%" y="2%" align="righttop"  οnclick="pausesoundtoggle(bggsnd); switch(crop, 0|0|50|50, 0|50|50|50);" />


            
  4.加入action動作

      <!-- startup action - load the first scene -->
            <action name="startup" autorun="onstart">
                playsound(bggsnd,'%SWFPATH%/sound/ChinaP.mp3',0);
            </action> 

    參考自:必學網

發佈了46 篇原創文章 · 獲贊 15 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章