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万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章