点击图片时我想播放声音。但是当我再次快速点击它时,它再也没有播放,因为另一个没有完成。我该如何调整呢?
我的代码:
var click;
click = new Audio("sound/ping.mp3")
click.volume = .75;
circle.on("click", handleMouseEventClick);
function handleMouseEventClick(evt){
click.play();
punten += 1;
score.text = "Score: " + punten;
stage.removeChild(this);
stage.update();
}
谢谢!
答案 0 :(得分:1)
试试这个:
function handleMouseEventClick(evt){
if(!click.paused){
click.pause();
click.currentTime = 0;
click.play();
}
else click.play();
}