troubleshooting Question

setinterval not working

Avatar of katyjack30096
katyjack30096 asked on
Adobe Flash
2 Comments1 Solution595 ViewsLast Modified:
I've got several sound clips running, one after the other. I'm trying to insert a pause of about 2 seconds between each clip. I want to keep the rest of the movie running, but just delay the loading of each clip. Right now, this is the way I've got it. (There's a function earlier in the code that sends the actionscript to this frame upon completion of the previous sound clip:

_root.showClip(slide2_mc,360,149,mx.transitions.Fly,0)
function wait(){
   play();
   clearInterval(IntervalID)
}
stop();
IntervalID = setInterval(wait,6000);

if (langFlag == "C") {
      _root.loadNextSound("Eng2.wav");
} else {
      _root.loadNextSound("Fr2.wav");
}

What's happening is that the code is blowing right through the stop(); and loading the next sound clip with no delay at all. If I put a trace on the wait function, I can see that the code is pausing 6 seconds and then running the wait function, but in meantime it's also running the rest of the script without stopping. What can I do to actually stop the script from running and wait 6 seconds?

Thanks -
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros