# Multiple sound files combined - problem

**URL:** <https://forum.kirupa.com/t/multiple-sound-files-combined-problem/212888>\
**Category:** flash\
**Created:** [January 15, 2007, 2:28pm UTC](https://forum.kirupa.com/t/multiple-sound-files-combined-problem/212888 "2007-01-15T14:28:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashe](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@Ashe](https://forum.kirupa.com/u/Ashe)\
**Post date:** [January 15, 2007, 2:28pm UTC](https://forum.kirupa.com/t/multiple-sound-files-combined-problem/212888/1 "2007-01-15T14:28:19Z")

</div>

Hi - The quick question is - I can only get this to play sound once - then it won’t do it again - why??

I am making a math game for my young kids - it adds numbers from 1 to 5  
the variables A & B are randomly generated and make C

The sound reads out a string A + plus + B + equals + C (5 sound files)  
It does this the first time the flash is played, however, when the flash movie goes back to the previous frame, and generates new variables - it will not play the sound files anymore.

Can someone help answer why the sound files will only play once…?

Here is the code I am using: - Regards Ash

// setup the sound object  
var calcVoice = new Sound(this);  
// add a function to “speak” each number  
calcVoice.speakNext = function() {  
// determine the correct sound file – [ex. “13.mp3”] 2 digits required  
var soundURL = “snd\_”+answerString.substr(0,2)+".mp3";  
// speak the current number  
if(answerString.length\>0){  
this.loadSound(soundURL,true);  
// get the next number  
answerString = answerString.substr(2);  
}  
}  
// when done, try to speak the next number  
calcVoice.onSoundComplete = calcVoice.speakNext;  
//add a function to start speaking  
/_calcVoice.speak = function(answer){  
// convert the numerical answer to a string – [ex. “123.456”]  
\_global.answerString = answer.toString();  
// start speaking  
this.speakNext();  
}_/  
calcVoice.speak = function(){  
// convert the numerical answer to a string – [ex. 123 = 111213]  
//Need to have 2 digits for each no. (99 is +) (98 is =)  
var convertString:String = “1”+A.toString()+“991”+B.toString()+“981”+C.toString();  
\_global.answerString = convertString;  
// trace(answerString);  
// start speaking  
this.speakNext();  
}  
/\*  
\_global.tempSound=function(){  
clearInterval(voiceInt);  
calcVoice.onSoundComplete();  
}  
calcVoice.noSound=function(u){ trace("url: "+u); voiceInt=setInterval(tempSound,30); }  
\*/  
calcVoice.speak();
