자바 스크립트 게임을 프로그래밍하고 여러 번 한 소리를 사용하고 싶습니다. 하나의 사운드를 배열에 더 많이로드하면됩니다. 하지만 하나의 사운드를 한 번로드하고 배열에 복사하려고하므로 여러 번 재생할 수 있습니다.HTML5 오디오 다중 재생
this.list = [
"LaserShot", //http://www.freesound.org/samplesViewSingle.php?id=39459
"Ding", //http://www.freesound.org/samplesViewSingle.php?id=5212
"Rocket" //http://www.freesound.org/samplesViewSingle.php?id=47252 -> http://creativecommons.org/licenses/sampling+/1.0/
];
...
for (i in this.list) {
this.sounds[this.list[i]] = new Array();
for (var j = 0; j < this.channels; j++) {
this.sounds[this.list[i]][j] = new Audio("./sounds/"+ this.list[i] + type);
}
}
난 그냥이 작업을 수행 할 수 :
for (i in this.list) {
this.sounds[this.list[i]] = new Array();
var tempAudio = new Audio("./sounds/"+ this.list[i] + type);
for (var j = 0; j < this.channels; j++) {
this.sounds[this.list[i]][j] = realCopyOfTempAudio;
}
}
는 정말 감사 이것은 내가 지금 무슨 방법이다.
5 살짜리 질문에 답해 주셔서 감사합니다. 시간이 지나면 문제를 해결할 수있을 때 사용해 보겠습니다. –