-
trouble playing tones with 100 ms interval
I have six tones that are stored in an array, and I am trying to play them with 100 ms in between the tones. They are 100 ms tones with 100 ms pauses between, but I am trying to use a for loop and they just get mashed together.
I've tried the set interval method, but I haven't had any luck (I've never used it before, so I may not be doing it correctly).
I'd appreciate any help I could get. Thanks a lot,
-
Senior Member
You can't use a for-loop to control timing because it's gonna try to execute all that code before rendering a single frame, and if the code takes too long to execute, you'll get the dreaded 'script is taking too long' dialog.
So either onEnterFrame or setInterval is the way to go. If you post your code in which you were attempting to use setInterval, I'd be happy to help you fix it (I'd prefer to correct existing code rather than write the whole thing from scratch).
-
setInterval
After seeing your response, I spent about two hours working out the correct usage of the setInterval method last night (at least for what I needed it for), and low and behold, that fixed my problem.
It's a little tricky to work with (setInterval), but I can see about a million uses for it.
Thanks a lot for your help!
-
Senior Member
That's a good thing - fixing it yourself is the best way to learn!
- Jim
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|