
Welcome Guest
|
#1
|
|||
|
|||
|
Hi - This script plays the sound first time it runs through the frames. But once it goes back to the previous frame and generates new variables, the sound does not play again. Anyone know why the sound does not play twice...??
I explored this site, and found some actionscript written for something similar to what I was after, I cannot find it again though - 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 + 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 Code:
calcVoice.speak();
// setup the sound object
var calcVoice = new Sound(this);
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();
}
calcVoice.speakNext = function() { // add a function to "speak" each number
// 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);
}
}
calcVoice.onSoundComplete = calcVoice.speakNext; // when done, try to speak the next numberLast edited by Ash7 : 01-16-2007 at 09:19 AM Reason: Clarify problem |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sound volume problem. | joedotts | Sound and Music |
4 | 03-12-2007 04:27 PM |
| Multiple sound instances AS | Liran | Flash MX ActionScript |
0 | 02-13-2006 12:10 PM |
| Detecting Movie Parameters \ Sound Play Button Problem | MathieuGPL | Flash MX ActionScript |
2 | 07-26-2005 06:09 PM |
| Trying to load multiple txt files into slideshow | mikelwynn | Flash MX |
0 | 02-22-2005 06:54 PM |
| playing multiple sound files | FXInc | Flash 5 Actionscript |
3 | 11-04-2000 01:04 PM |

Programming Languages



