-
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);
}
-
If you are using MX 2004, then the code should be this:
on (release) {
stopAllSounds();
}
-
Senior Member
If you don't think you're going to like the answer, then don't ask the question.
-
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 :-\
-
Senior Member
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.
-
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?
-
Senior Member
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.
-
hey great. thats awesome. i'm on flash 8. though publishing for flash 7.
thanks.
-
Senior Member
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.
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|