My problem is that I want to implement a keystroke sound (it's called "TextBeep" and the linkage name is also "TextBeep" it is a .WAV file) while a typewriter effect text is being played. As soon as all of the text appears, the sound should stop.
How do I do this? I have been looking for ages but there is only ones for ActionScript 3.0 and nothing for the code I am using. I am using Adobe Flash CS4.
Here is the code I am using:
var effectTxt:String = _root.effect.text;
_root.effect.text = "";
var startEff:Number = 1;
_root.onEnterFrame = function() {
if (effectTxt.length>=startEff) {
_root.effect.text = effectTxt.substr(0, startEff);
startEff++;
}
else {
delete _root.onEnterFrame}
};
If someone can tell me how to get it so it can automatically start as soon as the frame begins and the text start appearing and then to stop the sound after all text has appeared that would be great. Also, if you don't mind could you explain how you did it for future projects. Thanks!
so the sound effect is not a single "click" but multiple and long enought to not need a loop, right? Rather than enterFrame, use setInterval, you can better control typing speed...