1 Reply Latest reply on May 21, 2010 6:38 AM by kglad

    stop sound on reload


      Hi there,


      I have a selectino of swfs loading on designated keyoard events.


      My problem is that the sound from 1.swf continues when I re-load the next swf. Even when the image has stopped. Here is my code.


      var myrequest:URLRequest=new URLRequest("1.swf");

      var myloader:Loader=new Loader();




      //Adds event listener to the stage.

      stage.addEventListener(KeyboardEvent.KEY_DOWN, detectKey);



      function detectKey(event:KeyboardEvent):void



      if (event.keyCode==81) {

         var myrequest1:URLRequest=new URLRequest("1.swf");



      if (event.keyCode==82) {

         var myrequest2:URLRequest=new URLRequest("2.swf");



      if (event.keyCode==80) {

         var myrequest3:URLRequest=new URLRequest("3.swf");



      if (event.keyCode==84) {

         var myrequest4:URLRequest=new URLRequest("4.swf");



      if (event.keyCode==69) {

         var myrequest5:URLRequest=new URLRequest("5.swf");






      I hope someone can help me resolve this!

        • 1. Re: stop sound on reload
          kglad Adobe Community Professional & MVP

          if you're publishing for fp 10, apply the unloadAndStop() method to your loader, just prior to re-using the loader.  check if the loader's content is not-null before applying.


          if you're publishing for fp9, you'll need to explicitly stop the sound in the loaded swf or stop all sounds everywhere using SoundMixer.stopAll()