dcsimg
A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Mute Button

  1. #1
    Member
    Join Date
    Apr 2003
    Location
    Ocean Isle. NC
    Posts
    50

    Mute Button

    How can I make one button that will stopAllSounds in every MC, in every timeline. Basically I need a global stopAllSounds command.

    Thanks for your time.
    Becoming more machine everyday.

    Chad

  2. #2
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    code:
    _btn.onRelease = function() {
    stopAllSounds();
    };


  3. #3
    Senior Member
    Join Date
    Apr 2003
    Location
    Magnolia, DE
    Posts
    124
    Hey,
    I may not be 100% correct, but you cn just get a button with the command

    Code:
    on (release) {
        stopAllSounds();
        }
    It worked for me, i hope I was a help.

  4. #4
    Member
    Join Date
    Apr 2003
    Location
    Ocean Isle. NC
    Posts
    50
    That will only stop sounds on the current timeline, right? I need to make it work for all timelines in my movie. Anyone know how to do that? Thanks for respondng anyway.
    Becoming more machine everyday.

    Chad

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    StopAllSounds() will stop all playing sounds, but is not a mute action really. As soon as Flash encounters a new sound start (such as in a movie clip that continues to loop), then that sound will be heard as will any other sound start, Flash may encounter.

  6. #6
    Member
    Join Date
    Apr 2003
    Location
    Ocean Isle. NC
    Posts
    50
    OK, I understand. So what can I do to make a mute button? I need the user to click the button and all sounds stop, then when they click it again, all sounds start again. Any ideas?
    Becoming more machine everyday.

    Chad

  7. #7
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    I guess the only way would be to use different soundObjects, and to stop all of them on this one mute button.

    How many sounds do you have playing at the same time anyways? You'd want to mute buttons' punctual sounds and all others also?

  8. #8
    Member
    Join Date
    Apr 2003
    Location
    Ocean Isle. NC
    Posts
    50
    I want to stop the background music and button sounds. I'm not familiar with objects yet. How can I make a sound object? Thanks a lot for trying to help me out newbie.
    Becoming more machine everyday.

    Chad

  9. #9
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    hey, croque,
    take a look at www.kennybellew.com for all things sound.
    This should give a firm understanding of sound objects and all their funtions

    -myk

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Yeah, Myk! That's what I was getting at!

    In fact re-reading Kenny's How to Control Independent Sound Objects Simultaneously, I understand that if you use sound objects and want to be able to independently control the volume of each one of them, ...each sound object must be associated with its own unique movie clip.... Otherwise ...Any call to a method of a sound object, such as setVolume, will affect all sound objects that are the child of that particular timeline....

    So if Crocque didn't associate sounds with their own movie clips, and did set the volume of one of his sound objects to 0 (thus muting it), it would also mute all other sounds objects. Only thing left to check would be to see if setting back the volume of one of these objects back to 100, would do so for the rest of the sound objects?

  11. #11
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    something i did for small sound files was to load them dynamically as opposed to embedding them into the flas file..
    for example
    Code:
    //button noise
    bNoise = new Sound();
    bNoise.loadSound("mySound.mp3", false);
    this will load the mp3 into the object bNoise, and you can access it like this:

    Code:
    on(rollOver) {
         bNoise.start();
    }
    this is only good for very small sound files... i load them in while the main preloader is running so they'll be ready once the move begins


    hope this helps some....

    -myk

  12. #12
    Member
    Join Date
    Apr 2003
    Location
    Ocean Isle. NC
    Posts
    50
    Thanks everyone. That link helped alot. BTW this is a desktop tutorial of my company's software, not for the web, so no loading. It's the biggest project I've worked on yet. It was a tough one for me as an intermediate Flash developer. Note to self: "Always map out your navigation first". When I'm done, I'll give a link so you all can see it if you want.
    Becoming more machine everyday.

    Chad

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