Stop the sound when another sound bed

Hey guys,.

Using Flash Pro CC 2014, Actionscript 3

I work on a soundboard and use buttons which sounds and I would like to indicate that when a new sound plays, it automatically stops the current sound of the game, which sounds way 2 does not play at the same time.

But I also have a button which stops all sounds, I use the code 'Click to stop all sounds' Audio and video in Code snippets.

So I'm basically wanting to make sure that I can do both, hold the judgment of all the key sounds, but also have when you press any button sound, it stops all sounds and starts playing the button / current. Any suggestions?

BTW I'll implement the symbols such as buttons, not the clips video incase you need to know for coding, but I can switch to the clips if it's easier. I was just used to buttons on old versions of Flash for simple stuff like that.

Thank you.

the code that you have demonstrated stops all sounds (if there is) currently playing, and nothing else.

I don't know why looks like it would be "..." immediately start playing the audio file that is located on this button".

If you want sound to stop all the sounds and play NewSound, use:

sound.addEventListener (MouseEvent.CLICK, fl_ClickToStopAllSounds);

var sc:SoundChannel;

function fl_ClickToStopAllSounds(event:MouseEvent):void

{

SoundMixer.stopAll ();

var newSound:NewSound=NewSound();

SC = newSound.Play ();

}

Tags: Adobe Animate

Similar Questions

  • How to stop the sounds

    I encountered a small problem which is just my project look sloppy.

    When a person hits some buttons, a sound starts playing, but since the sound is long enough it just guard play and playing even after they are in a different domain.

    Even with a film, I have in the thing as well.

    How can I do when you press another button, I can stop the sound?

    Currently, it is set up like that...

    root

    Under root is the symbol screen

    Under the screen, after section 1 is a real symbol & the video file

    under actual finally is the audio file which is used...

    Try on properties of the (real) framework:

    under its:

    Sync: Stream (repeat: 1).

  • How can I stop the sounds in this scenario

    Hello, I need help.

    I need to load an external .swf file in my new movie and stop the sound/music that plays in the file external swf. I need the sound/music to stop immediately on frame one. I do not have the FLA to the external swf file as its years. Can someone help me with this? I know there are 'stopallsounds();' but I do not think I use this right because it does not block the sound when I play the new exported swf.

    So to summarize - I loaded in a .swf on a framework (in a clip from the Virgin film) - and on another layer, tried to add the "stopallsounds();" HELP - music continues to play - action!

    Hey that worked - rule you! Thank you very much!

  • Stop the sound of a button

    Hello..

    I have a small problem with the sound... I have an animation of main container with background sound which is full of soundChannel.

    I have also an external SWF that is loaded with video Clip buttons that have a BEARING ON sound on the timeline... after rolling discount - I place the:

    SoundMixer.stopAll (); to stop playing the sound button, once the mouse is released... However, the problem I'm running into is that it also stops the sound of the main container - suggestions clip? Thanks a bunch in advance!

    everything in your last message is correct, except that you use the soundchannel to load a sound.  you will use either the "new" constructor to instantiate your sound (if sound is in your library) or if you use a sound instance and the load() method of the sound class to load your sound.  the soundchannel is what is returned after applying the play() method to your sound. instance.

  • How stop the audio when I get out of the frame AS 3?

    Hello

    Could someone find out how to stop the audio when I get out of the AS 3 mounting frame? I had around 20 slides running in a swf file. Each slide has the distinct voice on attached to it. I added slides in a layer and voice in the next layer on the timeline.

    Ago next and previous buttons placed throughout this swf to navigate between slides. This is where the question arises. I can travel easily from 1 to 20 slides and even can return trip. But the voice does not stop as soon as I click on the previous or next buttons. It overlaps with the next or previous voice just above.

    I searched online and suggested its use as channel to bring voices on the slides to have a better control. But honestly I don't know how to do. Could someone help me in doing this? This problem can be very simple for others. As I am a beginner in Flash and Actionscript, it hurts.

    Carry me nicely, if this code seems to be bit annoying and even lenthy :-(

    Thanks in advance.

    Code:

    Forward_Button.addEventListener (MouseEvent.CLICK, forward);

    Previous_Button.addEventListener (MouseEvent.CLICK, prev);

    function forward(event:MouseEvent) {}

    if(this.currentFrame == This.totalFrames) {}

    Stop();

    }

    ElseIf (this.currentFrame > = 55 & & this.currentFrame < 201) {}

    gotoAndPlay (201);

    }

    ElseIf (this.currentFrame > = 201 & & this.currentFrame < 310) {}

    gotoAndPlay (310);

    }

    ElseIf (this.currentFrame > = 310 & & this.currentFrame < 430) {}

    gotoAndPlay (430);

    }

    ElseIf (this.currentFrame > = 430 & & this.currentFrame < 530) {}

    gotoAndPlay (530);

    }

    ElseIf (this.currentFrame > = 530 & & this.currentFrame < 640) {}

    gotoAndPlay (640);

    }

    ElseIf (this.currentFrame > = 640 & & this.currentFrame < 750) {}

    gotoAndPlay (750);

    }

    ElseIf (this.currentFrame > = 750 & & this.currentFrame < 860) {}

    gotoAndPlay (860);

    }

    ElseIf (this.currentFrame > = 860 & & this.currentFrame < 970) {}

    gotoAndPlay (970);

    }

    ElseIf (this.currentFrame > = 970 & & this.currentFrame < 1080) {}

    gotoAndPlay (1080);

    }

    ElseIf (this.currentFrame > = 1080 & & this.currentFrame < 1200) {}

    gotoAndPlay (1200);

    }

    ElseIf (this.currentFrame > = 1200 & & this.currentFrame < 1310) {}

    gotoAndPlay (1310);

    }

    ElseIf (this.currentFrame > = 1310 & & this.currentFrame < 1420) {}

    gotoAndPlay (1420);

    }

    ElseIf (this.currentFrame > = 1420 & & this.currentFrame < 1530) {}

    gotoAndPlay (1530);

    }

    ElseIf (this.currentFrame > = 1530 & & this.currentFrame < 1690) {}

    gotoAndPlay (1690);

    }

    ElseIf (this.currentFrame > = 1690 & & this.currentFrame < 1780) {}

    gotoAndPlay (1780);

    }

    ElseIf (this.currentFrame > = 1780 & & this.currentFrame < 1880) {}

    gotoAndPlay (1880);

    }

    ElseIf (this.currentFrame > = 1880 & & this.currentFrame < 2010) {}

    gotoAndPlay (2010);

    }

    ElseIf (this.currentFrame > = 2010 & & this.currentFrame < 2130) {}

    gotoAndPlay (2130);

    }

    }

    function prev(event:MouseEvent) {}

    If (this.currentFrame > = 201 & & this.currentFrame < 310) {}

    gotoAndPlay (55);

    }

    ElseIf (this.currentFrame > = 310 & & this.currentFrame < 430) {}

    gotoAndPlay (201);

    }

    ElseIf (this.currentFrame > = 430 & & this.currentFrame < 530) {}

    gotoAndPlay (310);

    }

    ElseIf (this.currentFrame > = 530 & & this.currentFrame < 640) {}

    gotoAndPlay (430);

    }

    ElseIf (this.currentFrame > = 640 & & this.currentFrame < 750) {}

    gotoAndPlay (530);

    }

    ElseIf (this.currentFrame > = 750 & & this.currentFrame < 860) {}

    gotoAndPlay (640);

    }

    ElseIf (this.currentFrame > = 860 & & this.currentFrame < 970) {}

    gotoAndPlay (750);

    }

    ElseIf (this.currentFrame > = 970 & & this.currentFrame < 1080) {}

    gotoAndPlay (860);

    }

    ElseIf (this.currentFrame > = 1080 & & this.currentFrame < 1200) {}

    gotoAndPlay (970);

    }

    ElseIf (this.currentFrame > = 1200 & & this.currentFrame < 1310) {}

    gotoAndPlay (1080);

    }

    ElseIf (this.currentFrame > = 1310 & & this.currentFrame < 1420) {}

    gotoAndPlay (1200);

    }

    ElseIf (this.currentFrame > = 1420 & & this.currentFrame < 1530) {}

    gotoAndPlay (1310);

    }

    ElseIf (this.currentFrame > = 1530 & & this.currentFrame < 1690) {}

    gotoAndPlay (1420);

    }

    ElseIf (this.currentFrame > = 1690 & & this.currentFrame < 1780) {}

    gotoAndPlay (1530);

    }

    ElseIf (this.currentFrame > = 1780 & & this.currentFrame < 1880) {}

    gotoAndPlay (1690);

    }

    ElseIf (this.currentFrame > = 1880 & & this.currentFrame < 2010) {}

    gotoAndPlay (1780);

    }

    ElseIf (this.currentFrame > = 2010 & & this.currentFrame < 2130) {}

    gotoAndPlay (1880);

    }

    }

    If your sound is directly on the timeline, then change to Stream will solve your problem, but you need to change every single audio clip.

    For example if VO #1 plays frame 1 to 100, you click anywhere in this layer (where you can see the audio waveform), go to properties and flow the Sync value. If VO #2 play frame of 101 to 200, you must click somewhere in there and do the same thing. Go to the properties, press the Sync drop-down list and change the event to Stream.

    This isn't a level property 'layer '. This is a property ONLY of audio current under your cursor is in. So if you have 500 your, you need to go to each of them and the value Stream Sync event 500 times.

  • Stop the engine when detects digital impulses of the reflective light sensor

    Hello

    I am doing my school project and I managed to make the deepening of the engine via digital port of the USB-6008 by setting the Boolean value of output in a while loop with use cases, but now I faced a problem because I have to use it with a reflective sensor and stop the engine when he feels a digital pulse. The sensor is configured as a counter using PFI0 on the USB-6008 with a circuit that will send in a digital pulse for data acquisition.

    How to stop the engine when the detector reflecting is blocked, and then start the deepening again when it is not blocked

    Thank you

    The top spot is always implemented as a counter.  You must change the DAQmx create channel as a digital input and the DAQmx interpreted as a Boolean variable digital 1 channel 1 sample.

  • can't stop the music when I get out of the page.

    Hi all;

    I continue to post in the wrong place.  I'm sorry.  I did this post in AC2 and responses did not look right.  So, here I am again.

    I'm building a website in flash using my limited understanding of action script.   Everything was very good train until I found that if I go to one of my example of my website pages and read (with audio) flash video and click on back to my "home" button, the audio will continue to play.   If I go back to the example page, the video is turned off and when I run the video, she plays again with the other audio.  I hear the audio twice! I know there is an action script to handle this, but I can't understand it.

    My question is, how can I stop the audio when I clicked away from the sample to the homepage or any other page page?

    Thanks in advance for your help.

    I'm using Flash CS4 and a Mac OS operating system.

    Did I mention that I'm not very good with scrupt action, but I'm so close to finishing this web site.

    assign your component an instance name (if it doesn't already have one), for example flv in the frame that contains this component, add:

    flv.addEventListener (Event.REMOVED_FROM_STAGE, removedF);

    function removedF(e:Event):void {}

    FLV. Stop();

    }

  • Help: How can I stop the sound when I go out of the frame?

    How to stop a puppetsound when I go to another frame.

    I created a button and attached the script below to play the sound

    on mousedown

    puppetsound "the abc song".

    end

    but I want the music to stop when I'm out of the frame

    at the moment when the music is still playing when I get out of the frame.

    any help

    thanx

    You are almost correct. However, I don't think you want to reply to a #exitFrame message and stop your sound (depending on where you have the related code). Instead, use the #endSprite message (issued when the playback head leaves the span of a sprite in the score):

    on mouseDown me

    Sound (5) .play (member ("the abc song"))

    end

    on endSprite me

    Sound (5). Stop()

    end

  • How can I stop the sound of reading back to me, when the voice recording

    How can I stop the replay to me a second after that I recorded (audio narration). First 14 elements?

    Roger

    I think that perhaps this is the only option, Bob. I couldn't find another way.

    Unfortunately, if you are wearing your headphones and listen to the audio of the film, when you save, you will hear the echo too.

    It's just the way it works and there is no way to stop doing that I know.

  • Stop the sound of back/forward

    I was wondering if there is any way to stop the rewind and advance fast sound you hear when you move the back or front chronological marker along your videos. Or is there a better way to quickly navigate through videos? I know that his happens because music, I added its annoying me...

    marker.jpg

    Céline

    Thanks for the reply. Just as I suspected.

    14 elements of first (the most recent version and just came out) has undergone changes in its mounting Panel. Especially ones involving audio tracks.

    Please refer to point 2 at the top of my blog first elements 14 First Look details ATR first troubleshooting items: first items 14 First Look details

    If you have the first 13 items, you do not have the muting of the audio track to which you were referred. In the first elements 13/13.1, these icons to the left of the track name are for display only - style for videos, 4 display styles to select from and for audio 2 display styles to choose one (with as wave and no waveform). But nothing of what I just wrote will influence your elements first 13 base want to silence the audio when you scroll the contents of the timeline.

    A possibility to explore

    1 video 1 video track with audio related on the Audio 1 track. And you want to scroll the timeline without the sound.

    2. open the Audio Mixer (mixer Audio/Menu Tools table) and put a check mark next to the button Mute for 1 Audio track. Resize the Audio Mixer Panel, it is out of your way, but you always silent access to the box.

    3. put the box of Mute, when you do not want sound. Remove the check mark for mute when you do not want sound.

    I'll think about it even more.

    RTA

  • Stop the sound

    Hey guys,.

    I try to add two functions in a single button, first of all, it will take me to the next frame and the other stops the music being played

    I have this written already, jump to the following framework works but the stop function does not work even if the program is still running and no error message come up... help

    import flash.events.MouseEvent;

    import flash.media.Sound;

    import flash.media.SoundChannel;

    Stop();

    Create a new sound variable 'theSunSound' to the name of the given class

    the audio file in the library 'theSunSoundFile '.

    var theSunSound: theSunSoundFile = new theSunSoundFile();

    Variable set

    theSunSound.play ();

    btnGoodJob.addEventListener (MouseEvent.CLICK, bGoodJob);

    function bGoodJob(event: MouseEvent): void {}

    gotoAndStop ("Start");

    Create a new variable of channels of sounds 'theSunSoundChannel '.

    / * This is required only if the sound will do more than just play

    That is to say: stop, pause, etc... */

    var theSunSoundChannel:SoundChannel = new SoundChannel();

    / * Create a variable to store the position of the "read head".

    of "theSunSoundChannel" * /.

    var theSunSoundPausePosition:Number = new Number();

    Set the time of the "read head" to 0

    theSunSoundPausePosition = 0;

    / * Create a Boolean variable called 'theSunSoundPlaying '.

    This goes from true to false as the case

    "theSunSoundChannel" plays * /.

    var theSunSoundPlaying:Boolean = false;

    Stop playback of the variable "theSunSoundChannel".

    theSunSoundChannel.stop ();

    Change 'theSunSoundPlaying' Variable to false

    theSunSoundPlaying = false;

    / * The 'theSunSoundPausePosition' value of 0, it

    reset 'theSunSoundChannel' to read from the beginning * /.

    theSunSoundPausePosition = 0;

    }

    Yes, somehow, but you define another instance of the string inside the function.  Get rid of that too.

  • Stop the sound at the click of the mouse in Actionscript 3

    So I have this code, I want the sound to stop when I click on the Start button, but when I click on the Start button, the sound does not, but its volume is decreased, it's very weird. If anyone can solve this?

    var mySound:Sound = new Sound();

    mySound.load(new URLRequest("Sounds/Sound.mp3"));

    var channel:SoundChannel = mySound.play();

    channel = mySound.play();

    StartButton.addEventListener(MouseEvent.CLICK, StartGame);

    function StartGame(e:MouseEvent):void {

    channel.stop();

    gotoAndPlay(2);

    }

    The code that show you should not have any effect on the volume change.  I don't know what happens after the call to the play() twice method however.

    Try to change these two lines so that you only call the play() immediately method...

    channel: var SoundChannel = new SoundChannel();

    Channel = mySound.play ();

  • stop the sound with the action script?

    Hello

    Im a beginner with action script, and is there a way to stop a sound using actionscript?

    My sound is called "CRICKET.mp3", if it is necessary to know.

    You can still use:

    SoundMixer.stopAll ();

    to stop all sounds.  but, if you want to stop a particular sound, you must apply stop() to soundchannel your sound (created when the play() method is applied to your sound).

  • Stop the sound from the external SWF

    Here's my problem. I have a main.swf and I load an external audio player.swf. I need to stop the player.swf sound when I press a button on the main.swf. Not all the buttons just a few buttons. I have now, I have to put the code in each button. Thank you

    have you tried stopAllSounds()

  • Stop the sound on mouseout/mouseouthandler() - how/where add code

    I read through several threads, but I can't figure out how or where to add the code for the sound to stop on mouseout/mouseouthandler(). I read the messages that buzz.js might be able to help, but I need advice to apply it.

    The project is included in the download. The US Landmarks each have an animation that starts a stopover on mouseover and mouseout/mouseouthandler(). I need the sound that goes with each animation to do the same.

    Firefox handles its OK at first but then seems to get glichy. Chrome keeps all the loop sounds whenever I mouseover.

    https://www.dropbox.com/s/x2iih9sgqff316i/SummerTips_052114_0430.zip  I apologize for the large file. I am looking for an alternative to a single sound file that is larger than 6 MB.

    It is my first project in environmental assessment. I learned EA as I build it (conversion of project Flash that someone else did a few years ago). I'm sure that there are more effective ways to do a lot of what I have here, but it works in the way he needs, except for the sound.

    I am open to any suggestion. Thanks in advance for the help.

    Lynn

    Hello

    There are some errors in your code above:

    In the mouseenter event:

    sym.getSymbol("space_shuttle").$("Spaceshuttlelift-off") [0] .play ("enter");

    There's no label "enter" for the audio element. It should be:

    sym.getSymbol("space_shuttle").$("Spaceshuttlelift-off") [0] .play ();

    The biggest problem is in the mouseleave event:

    sym.getSymbol("space_shuttle").$("Spaceshuttlelift-off") [0] .stop ("exit");

    The audio element is not a stop method. You must use the break and with no label in there, like this:

    sym.getSymbol("space_shuttle").$("Spaceshuttlelift-off") [0] () .pause;

    HTH,

    Joe

Maybe you are looking for

  • OfficeJet 6700 Premium: Officejet 6700 the computer scanner has stopped working

    My scan of the computer stopped working with my PC HP 10 Windows, I ran doctor scan it says driver error and can not solve the problem, but I seem to have the latest version of the driver and the fax does not either, so only print work. All is connec

  • Satellite Pro A300D-161 why I can not download the latest version of the Bios Toshiba

    Hello I need your help because I can not download the latest version of the Bios for my laptop to the toshiba-europe support page.Either internet expoler 8, or firefox can not open the Bios download page.Why is this problem? Thre is anyway to fix it?

  • Guaranteed + hard drive failure

    Hi, my hard drive is about to fail not, but my laptop is more than 1 year, so no warranty for the laptop. Since the problem is with the drive HARD only I thought it might have a different length of the warranty. Is this true? I read that the life exp

  • ReadyNAS Replicate

    After the migration of my account ReadyCloud account MyNETGEAR.com that I can not log on the Readynas replicate page. My ReadyCloud works ok after the migration, but when I try to log in my reply nothing happens. Why? I do wrog? The backups work alth

  • Why lsass.exe consumes resources after the start?

    Lsass.exe turns 15-20% cpu level for 10-15 minutes after the start.  I have a fast, dual-core machine and the latest XP.