This content has been marked as final. Show 7 replies
setInterval() always works and is fairly accurate unless you need close to 10 millisecond accuracy (in which case you can correct setInterval to maintain accurate timing).
any problem with clearing your intervals is a coding and coder problem.
Thanks - I agree that it's the old "nut loose behind the keyboard." if I know it's me, I can work with it.
I just forgot the "Don't Panic" maxim.
One thing though, is there any condition other than a code problem where a short audio clip could play twice during an interval? At the time it was a one-frame application, mostly ActionScript, and I cleared the interval after starting the sound right in the function itself.
1. always use clearInterval() PRIOR to each setInterval() and again when a termination condition is met.
2. how is your sound created? with actionscript or attached to a timeline?
I came across your suggestion to clearInterval before setInterval (in several threads), so I started doing it. I'm also using stopAllSounds() when a button is pressed.
This is how the sounds are loaded: in frogAudio.swf, a 1 frame swf, I have the sound files in the library, then do this:
Then in the first frame of the movie, I have an empty audioHolder_mc, and load the file with:
you need an _rootI2vo1.start() in frogAudio or (and not both) _root.audioHolder_mc.I2vo1.start() in your main swf to start your sound. if that start() is executing once, your sound will play once.
Roger that. I had a hard time debugging because I wasn't sure if there was some behavior I was unaware of. I think it's working reasonably well now.