A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: trouble playing tones with 100 ms interval

  1. #1
    Junior Member
    Join Date
    May 2004
    Location
    Philadelphia, PA
    Posts
    24

    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,

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    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).

  3. #3
    Junior Member
    Join Date
    May 2004
    Location
    Philadelphia, PA
    Posts
    24

    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!

  4. #4
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center