A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Can't mute sound

  1. #1
    Senior Member
    Join Date
    Jun 2000
    Posts
    284

    Can't mute sound

    I'm having trouble figuring out how to mute the sound with a button. Here's the CONTROL object that currently handles the sound:

    onClipEvent(load)
    {
    _root.soundstatus="on";
    _root.mySound = new Sound(_level0);
    _root.mySound2 = new Sound(_level1);
    _root.mySound3 = new Sound(_level2);
    _root.mySound4 = new Sound(_level3);
    _root.mySound5 = new Sound(_level4);
    maxvolume=100;
    minvolume=0;
    }

    onClipEvent(enterFrame)
    {
    if(_root.soundstatus=="on") {step=5}
    if(_root.soundstatus=="off") {step=-5}

    maxvolume+=step;

    if (maxvolume>100) {maxvolume=100;}
    if (maxvolume<0) {maxvolume=0;}

    _root.mySound.setVolume(maxvolume);
    _root.mySound2.setVolume(maxvolume);
    _root.mySound3.setVolume(maxvolume);
    _root.mySound4.setVolume(maxvolume);
    _root.mySound5.setVolume(maxvolume);
    }

  2. #2
    Junior Member
    Join Date
    Mar 2006
    Posts
    9
    If you are using MX 2004, then the code should be this:

    on (release) {
    stopAllSounds();
    }

  3. #3
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    how is your loaded?
    If you don't think you're going to like the answer, then don't ask the question.

  4. #4
    Senior Member
    Join Date
    Jun 2000
    Posts
    284
    Excellent That works, although for some reason when I try to turn the music back on with the "Sound on" / "Sound off" button it never comes back on :-\

  5. #5
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    how are u loading the sounds, cause stopAllSounds() doesn't work sometimes.
    If you don't think you're going to like the answer, then don't ask the question.

  6. #6
    Member
    Join Date
    Oct 2002
    Location
    new york
    Posts
    90
    i'm having the same problem. i have all my sounds are on the timeline (for streaming purposes). i want a button that can toggle the sound off and back on. StopAllSounds won't work because ya can't get the sound back on.

    ultimately, we both just want to turn the volume down to zero and back to 100. Is flash too stupid to have a simple uber volume setting? or am i too stupid to find it?

  7. #7
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    here's what you can do take the sounds from the timeline and create movieclips for the sounds. edit the movieclip and put the sound on that timeline. Then drag the movieclip on the stage, give it an instance name and treat the sound a soundobject. I'll send you a sample. what version of flash are you both using?
    If you don't think you're going to like the answer, then don't ask the question.

  8. #8
    Member
    Join Date
    Oct 2002
    Location
    new york
    Posts
    90
    hey great. thats awesome. i'm on flash 8. though publishing for flash 7.

    thanks.

  9. #9
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    The sample has imported sound loaded into a movieclip. It's controlled by buttons on the stage. I use a soundObject to control the muting of the sound movieclip, and the play and stop buttons control the timeline of the soundclip (movieclip with sound on the timeline). If any questions, please ask or pm me. Do you know what version of flash Jared1 is using?
    http://www.keithborders.com/FlashSam...eSoundClip.fla
    If you don't think you're going to like the answer, then don't ask the question.

  10. #10
    Member
    Join Date
    Oct 2002
    Location
    new york
    Posts
    90
    i'm still a little nervous about it streaming properly when its not on the main timeline with all of my other assets, but i'll give it a whirl. thanks again.

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