1 Reply Latest reply on May 6, 2009 6:37 AM by kglad

    How to pause, stop, play a sound that is loaded from the other .swf file?

    xxxheeroxxx Level 1

      Pause and Resume external SWF sound files

       

      I have this code that plays the sound through linkage. It reside in scene1.fla -> scene1.swf.

       

      var mc:MovieClip = this.createEmptyMovieClip("mc",1);
      var myLoop:Sound = new Sound(mc);
      myLoop.attachSound("bg_sound");
      myLoopVolume=0;
      myLoop.setVolume(myLoopVolume);

       

      mc.onEnterFrame = function () {
          if (fadeIn01==1) {
              _root.myLoop.setVolume(myLoopVolume);
              myLoopVolume=myLoopVolume+5;
              if (myLoopVolume>50) {
                  fadeIn01=0;  
              }
          }
          if (fadeOut01==1) {
              myLoop.setVolume(myLoopVolume);
              myLoopVolume=myLoopVolume-1;
              if (myLoopVolume<5) {
                  _root.myLoop.setVolume(10);
                 // _root.myLoop.stop("myLoop01");
                  fadeOut01=0;
              }
          }
      }
      fadeIn01=1;
      myLoop.start(0,999);

       

      The problem goes like this. I want to pause the sound from playing in scene1.fla -> scene1.swf in anytime I want, through my main.fla -> main.swf that loads the scene1 movie. I got stuck.