[Flashcards]update Flashcards(tizen_2.1)
[samples/web/Flashcards.git] / js / sound.js
index 438caa8..2afafe6 100755 (executable)
@@ -7,7 +7,15 @@
  *
  */
 
-function GameSound(id, loop) {
+function GameSound(id, src, preload, loop) {
+    var audioElement = document.createElement('audio');
+    audioElement.setAttribute("id", id);
+    audioElement.setAttribute("src", src);
+    audioElement.setAttribute("preload", preload);
+    if (loop)
+        audioElement.setAttribute("loop", "loop");
+    document.body.appendChild(audioElement);
+
     var me = this;
     this.id = id;
     this.soundobj = document.getElementById(id);