stop the music during the scene change

I make a game with AS3. I want to put different music in each context.

So far I managed to start the music when the player enters a scene. But if it turns off, the music is still playing... (I want the music to stop when the players leave a scene).

I do not understand why the music is still playing... Here is my code:

public function newBackground(thisBack:String):void{

var room = back.currentBack;

switch (thisBack){

case "maisonExt":

var mySound:Sound = new exterieur ();

mySound.play ();

My mp3 file is named "exterieur.mp3".

If you can think of anything, it would be a great help.

Thank you!

If you want the music to stop, you tell him to stop.  The Sound class doesn't have a stop method, but done SoundChannel class.  You create a SoundChannel instance and assign to the transformation of Sound.play.  Then you can use it to stop the sound.

var sc:SoundChannel;

SC = mySound.play ();

TCI Stop(); to stop the sound

Tags: Adobe Animate

Similar Questions

  • Re: Start and stop the scene/video button

    I need help to fix my departure and switch to stop.  It will start the video scene, but it will not stop if I click on the Start button. Please correct my code.  Thank you.

    Process.Visible = false;

    Cycles.Visible = false;

    Stop();

    function playMovie(event:MouseEvent):void

    {

    Play();

    }

    startButton.addEventListener (MouseEvent.CLICK, playMovie);

    var paused: Boolean = false;

    function myPauseFunction (): void {}

    {if (Paused)}

    Play();

    paused = false;

    }

    else {}

    Stop();

    paused = true;

    }

    change:

    function pauseMovie (): void {}

    {if (Paused)}

    Play();

    }

    else {}

    Stop();

    }

    pause =! suspended;

    }

    TO:

    function pauseMovie (e:MouseEvent): void {}

    {if (Paused)}

    Play();

    }

    else {}

    Stop();

    }

    pause =! suspended;

    }

  • Stop the "Recently changed" archive in your history folder

    Do all the files that you use or access appear automatically in the folder "recently changed"? Can you stop the files to be indexed in this file?  I also have files that I've trashed and yet they still appear in the recently changed folder.  What can I do about it?  Can I change the properties to stop this archiving of my story?

    There is no list. The system will search the index file and creates it each time you click the search folder. Everything is stored in the search folder are the instructions on how to perform the search.

    The index should contain only references to the files that have been deleted. Maybe now you have reset those will stop to reappear.

    You can also try this Fixit http://support.microsoft.com/mats/windows_search/en-us

    If you do not want the index must be created, you can use one of the following methods of indexing:

    http://www.mydigitallife.info/disable-and-turn-off-Windows-Vista-search-indexer-and-indexing-service/

    This can affect performance and remove other features of the system.

    There is nothing don't delete you saved search folders. This will not remove the underlying files. See this article for more information:

    http://www.Vistax64.com/Vista-file-management/131471-recent-searches-folder.html

  • How to stop the HP change my .jpg file type

    I just bought a new desktop HP Pavilion with Windows 7 computer. When I downloaded my files from my old XP computer .jpg something HP changed my HPTSMVP file type. JPG. The problem with that is when I open a picture of the opening of the HP Media Smart program. Call me old school (or just old) but I want the files to open in Internet Explorer, as do other computers.

    How can I say HP if stop change my file type?

     

    Otherwise, what are the benefits of leaving the peak open in Media Smart? In other words maybe an old dog can learn new tricks. Woof!

    Right mouse click on one of your JPGs, select properties and then select the button change. The rest should be easy.

  • How to stop the case change in SQL developer Editor

    Dear friends,


    When I begin editing in Developer SQL (version 1.6), case or formatting words is changed automatically.
    Y at - it no option to stop the change of the case.

    Thanking in advance
    Sanjeev

    Assuming you're the 2.1.X SQL Developer trying to disarm

    Tools-> preferences-> Code Editor-> completion Insight-> change as you type

  • FOW to stop the resolution changing its recommended setting

    resolution on my computer he changes with the night when the PC is turned off and even in the mddle of a program, how to stop it please

    Hello

    1. What version of Windows are you using?
    2. What is the brand and model of the computer?
    3. Have you made changes on the computer before this problem?

    I suggest you to try the following method and check the status of the issue.

    Hardware devices do not work or are not detected in Windows.

    http://support.Microsoft.com/mats/hardware_device_problems/en-us

    If the problem persists, I suggest you to send us more information to help you better.

  • How can I stop the XP change my selections to display on each reboot?

    I select the appearance of the classic view and no screen saver.  After a restart, XP changed the XP default settings that I don't want these back.  I need help changing the settings from XP.  Video card is a GEFORCE 6200 AGP from NVIDIA.  The system is a Pentium 4 3 GHz with ASRock P4V88 motherboard.

    This looks like a corrupted user profile.  When Windows detects a damaged when connecting user profile, it creates a temporary profile that is used until you log out, date on which it is removed and all of your modified preferences are lost.  You can confirm this by creating a new user on your computer, log in as a new user, and if this problem does not apply to this user, then you have a problem of corrupted profile.

    Recovery is quite simple.  The following procedure describes the steps:
    "How to recover damaged Windows XP user profile"
      <>http://support.Microsoft.com/kb/555473 >

    Since the corrupt profiles are usually accompanied by corruption in the disk file system, as soon as a disk check would also be justified.  Do a 'chkdsk' with the /f or/r option.  Audit will be conducted at the next reboot of the system.  Fair warning: usually, a full disk check takes between 2 and 4 hours and cannot be interrupted.  Suggest to perform during the night or when you won't need your machine for awhile.

    "How to perform disk error in Windows XP check"
      <>http://support.Microsoft.com/kb/315265 >

    HTH,
    JW

  • How to stop the flashing/change pointer in Firefox 27.0?

    I have a problem with the pointer constantly flashing or switch between hand tools and 'write' when it hovers over the links. I tried to restart in mode without failure, turn the circumflex, navigation, closing tabs, update Flash Player, Java Update, restore the factory settings and restart the computer. None of this has worked. Either way, I'm on Mac OS x 10.6.8.

    1. In the menu bar, click on the Firefox menu and select Preferences...
    1. Select the Advanced tab.
    2. Select the general tab.
    3. Uncheck the use hardware acceleration if available.
    1. In the menu bar, click Firefox and select Quit Firefox
    2. Launch Firefox normally.
  • the terrible scene changes and the Preloader


    I put a lot of blood, sweat, and tears in the construction of this site and the simple elements are initially most bad.

    Scene changes (used to), I found early on that if I moved the longest scene at the end, it did not conflict with the other menu buttons. She appears as randomly, or when the movie is slow to load, the buttons go to the bad scene and begin to play random frames and buttons will not react.

    Preloader works (on stage), when I move the eact same code to another scene and just change bodies and information from the scene, I get only a blank screen when the movie loads, and then to top it off, it will redirect to another scene in an odd field. I tried a number of different codes to operate the preloader, all of the standard "remain on this picture until the load rest and then play" codes.

    I think that these two problems are related, and I was looking for information on ROOT and OVERALL because I don't really understand them. You can see some of my flash to www.danieljkessler.com site I think that the problem is not the way I'm coding, but I'm missing something which is in conflict with the scene changes. Still, navigation appears to work correctly in the file real film, but when his online or viewed, it has these unpleasant problems.

    I am willing to pay a small fee for fixed or I will correct myself if anyone can enlighten me as to what causes these problems.

    I discovered that you can not put a preloader on each stage, only once. So that was the problem. Took me a long time to understand the preloader script to load only partially, so I'll post here incase someone else has the same problems. Also, this person, you want to create multiple swf files and load them in the file of the external location. This way, you can have a preloader for each scene. A note is to try to avoid the scene changes and work within a timeline and also scenes to load up and down unless you change the publishing setting, so if you load your film only partially and can find some buttons for posting a link to the site immediately, rearranging the scene download order by dragging the scenes in the scene in the order window can help fix this problem.

    Second, the problems with the scene buttons works not when the file was loading is because they establish between scenes that have not yet loaded. The preloader can solve this problem. Using the name of frame instead of the scene and the number setting usually works but I think that flash like consistency. If I use the same key in the case of difference, I had to use the same format for the onRelease to work.

    I have to say, the flash is powerful but its also a huge pain in the *. Don't be fooled, CS3 is not all powerful. I can't emphasize enough easily hard things were to do and hard things easy to do. Flash design is nice, but a flash script is real witchcraft.

    Thanks for all your answers quick and useful kglad, especially during the holidays. My site is available at www.danieljkessler.com, I must still do version Chinese, but I intend using the same file and change and redo some of the buttons with the English. God help me.

  • Stop the timeline, but show a loop of symbol that the timeline is restarted

    Is it possible to stop a schedule but still have a symbol, more precisely a spritesheet symbol, continue to play?

    I'm working on a project that requires the end user to read a narrative text while the described process is illustrated by the graphic animation. The public is multicultural/lingual, if we want to leave as much time reading the text as it is necessary. Our solution for this so far has been to stop the scene with a trigger then have restarted the timeline with a mouse of the user, click. That has worked so far, but now I need to have the illustration animated in the background, while the timeline is stopped waiting for the user to restart the chronology. Is this possible? If this is not the case, how should this problem approaching, as the click of the mouse is part of a symbol used in other animations in a series?

    Thank you

    Ron

    I managed to do work by looping the symbol Sprite sheet on his internal calendar.

    R-

  • I have flash cc on a macbook pro and I can't do the audio stop once I changed the scene, how do I get him to stop?

    Captura de pantalla 2016-01-22 a las 9.44.54 AM.png

    A sound in the timeline panel will continue until it is finished, or tell you him to stop playing. Unfortunately moving to a new scene will not stop the sound. You can place this Actionscript at the beginning of the new stage, and it stops all sounds in the game:

    import flash.media.SoundMixer;
    SoundMixer.stopAll();

  • Change the settings of "breathe" during a scene

    I record a scene with the behavior of breathe. The character is calm for most of the scene and has slow breaths / minute, but in the Middle he is afraid of something, and I want him to breathe a lot heavier and faster for a few moments while he's afraid, then back to normal. I was not able to understand that well. It is even possible to do so, through several takes, or something like that? Or are the parameters that you set for the constant of behavior to breathe throughout the scene?

    Well Yes, quite feasible. Then you can arm all parameters by clicking the red dot next to him. So, if I were you, I would:

    • Inhale your arms "breaths per Minute".
    • Switch to the normal initial BPM, like Let's say 15.
    • Check-in for a second.
    • Extend the taking by dragging the right edge, so he's going for the duration of your timeline.
    • Move to the place where it becomes intense.
    • Set the BPM to something more, like 100.
    • A record for a second time.
    • Drag this new Jack for the duration of the intense part.
    • Timeline > mix take > Blend In and Out (or drag for custom timing) to increase the more progressive breathing.

    Anything with a circle next to him can be armed and saved. So if you ever want to force eyebrow at 500% or, on the one hand, you can do it.

  • during the game Dungeon Siege Broken World, it stops the game and I get the exception error

    Original title: exception errors

    during the game Dungeon Siege Broken World, it stops the game and I get the error of the exception that the program brings together except for the tour program off that I have to start

    Hi irishlaird,

    1. What is the full error message that you receive?

    2. did you of recent changes on the computer?

    Check out the links and try the steps mentioned below.

    http://garage.gaspowered.com/?q=node/9419

    http://garage.gaspowered.com/?q=node/6386

    http://garage.gaspowered.com/?q=node/5573

    http://garage.gaspowered.com/?q=node/5357

    If the previous step fails, then validate your request on the website of the game provider.

    http://garage.gaspowered.com/?q=Forum/169

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Agent failure during the ownership change processing

    Hello

    Could someone help me in this issue:

    Data collection is stopped due to the following error:

    15-02-2013 02:08:43.916 ECHO ERROR [IncomingMessage-12294] com.quest.glue.core.jfogbank.JFogbankAgentImpl - an unexpected error has occurred which may cause undesired behavior. You can contact Quest Software customer support if you see this error again: Agent failure during the ownership change processing
    java.io.IOException: no connection is made to com.quest.glue.core.jfogbank.JFogbankAgentImpl@6176959c
    at com.quest.glue.core.jfogbank.JFogbankServer.waitForConnection(JFogbankServer.java:403)
    at com.quest.glue.core.jfogbank.JFogbankAgentImpl.startDataCollection(JFogbankAgentImpl.java:295)
    at com.quest.glue.core.jfogbank.JFogbankAgentImpl.propertiesChanged(JFogbankAgentImpl.java:475)
    to com.quest.glue.core.services.ASPServiceImpl$ ListenerAdapter.propertiesChanged (ASPServiceImpl.java:606)
    to java.util.concurrent.ThreadPoolExecutor$ Worker.runTask (ThreadPoolExecutor.java:886)
    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

    15-02-2013 02:08:43.916 ECHO [IncomingMessage-12294] INFO com.quest.glue.core.services.AgentStatusServiceImpl - failure reported Agent
    15-02-2013 02:08:49.673 ECHO VERBOSE [Windows_System_on_ctsintcovsods3.cts.com AgentStatusService] com.quest.glue.core.agent.AgentInstance - data collection to stop

    What does this error mean?

    Kind regards

    Shiva

    Hey Shiva,

    you are probably using the OS cartridge inherited on x86_64, RHEL or CentOS 6.3 or earlier.

    You must install both 32-bit libraries to do the data collection:

    • -glibc.i686
    • -nss - softokn.i686

    Why is this?

    By dΘfaut x86_64 installation does not seem to install libraries 32 bits, which prevents OSCart commissioning agents.

    Fortunately, OSCart agents are largely independent, and only the C 32-bit kernel libraries (and their dependencies) must be installed in order to get the agents running. Needed to support packages are available on the RedHat 6 32-bit installation DVD in the directory {{packages}}.

    https://support.quest.com/SolutionDetail.aspx?ID=SOL89778

    Best regards, Falco

  • stop the music, if another music starts

    Hello, sorry if my bad English

    How can I do

    musik.jpg

    -Click the button 1, another stop of music and music 1 start

    -Click the button 2, another stop of music and music 2 start

    -Stop all button clicks, all stop music

    Hi Ony,

    1. change the instance name of button as mus_1 and mus_2. Place the "_" before the number in the name of the button

    2. check the name of the instance to STOP ALL button (it should be 'stopall') and try

    Thank you

Maybe you are looking for