A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: stopping sounds

  1. #1
    Junior Member
    Join Date
    Jun 2002
    Posts
    25

    stopping sounds

    Greetings all.

    Should be easy enough, but I can't stop 2 different sounds with one click. Here's the deal: I have one sound that loops throughout the movie and another sound effect that plays every other 5 seconds. I can stop and start the loop with no problem. But I can't stop the sound effect. Is there a way to mute all sounds?

    Any info would be greatly appreciated as I'm running out of time.

    Thanks in advance!

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    there are so many ways to use sound that a bit more info would help. Is it a plain sound loop? are you using attachSound? is the sound fx playing every 5 secs because of a getTimer() script? or is it just in a movieclip with appropriate number of frames? are they loaded? on the main timeline? etc..
    A bit of code would help: ie -how does it start playing in first place?
    gparis

  3. #3
    Junior Member
    Join Date
    Jun 2002
    Posts
    25
    hopefully this will help (I'm a bit of a novice with actionscripting).

    I use this for the sound loop, placed on the first frame of the movie:
    s = new Sound();
    s.attachSound("mySound");
    s.start(0, 999);

    I use this for the sound effect, placed every 20 frames in a movieclips timeline:
    t = new Sound();
    t.attachSound("mySound2");
    t.start();

    to stop the sounds, I'm using this, but it only stops the loop:
    on (release) {
    s.stop();
    Last edited by jspaceman; 12-19-2002 at 01:08 PM.

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    I use this for the sound effect, placed every 20 frames in a movieclips timeline:
    t = new Sound(); t.attachSound("mySound2");
    t.start();
    So,have that movieclip stop so the sound will not be called again, and use:
    t.stop();
    gparis

  5. #5
    Junior Member
    Join Date
    Jun 2002
    Posts
    25
    My previous post must have been cut off. But on the "sound off" button I use:

    on (release) {
    s.stop();
    t.stop();
    }

    The problem (I think) is that the sound effect is being called 6 times in the timeline. The "sound off" button will stop the sound effect only if it's currently playing. Then, once it's called again in a couple seconds later, it will play.
    Last edited by jspaceman; 12-19-2002 at 01:33 PM.

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    have that movieclip stop
    If that clip stops looping the sound will not be called again
    gparis

  7. #7
    Junior Member
    Join Date
    Jun 2002
    Posts
    25
    I figured it out. I put a set volume on the first frame and then set the volume to zero on the "audio off" and it worked just fine.

    Thanks so much for the help!

    Enjoy the holidays!

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