如何使用html5画布停止/播放?

时间:2016-07-03 08:17:04

标签: animation actionscript html5-canvas

嗨,我是html5画布的初学者。我尝试了所有关于如何停止音乐的代码,但即使我点击播放/暂停按钮,它也会继续播放。

代码:

var comp = this;
var pause = "false";
//var req:URLRequest = new URLRequest("pokemon.mp3");  
//var sound:Sound = new Sound();  
//var controller:SoundChannel; 

comp.push_btn.addEventListener("click", stopAnimate);

function stopAnimate()
{
    if(pause == "true")
    {
        comp.stop();
        //controller.stop();  
        pause = "false"
    }
    else
    {
        comp.play();
        //controller = sound.play(); 
        pause = "true";
    }
}

1 个答案:

答案 0 :(得分:0)

{{1}}