3 Replies Latest reply on Jul 12, 2006 8:31 PM by Newsgroup_User

    Stop/Play All Sounds Too

    cyphernic
      Hi There,

      The play / stop button I have works...but the sound files continue playing.

      This is the script I have:

      button1.onPress = function() {
      MovieClip.prototype.onEnterFrame = function() {
      if (_root.direction == "stop"){
      this.stop();
      }else {
      this.play();
      }
      }
      _root.direction = "stop";
      }
      button2.onPress = function() {
      _root.direction = "go";
      //delete MovieClip.prototype.onEnterFrame;
      }

      is there any way to stop/play the sound files (in the current frame) also?
        • 1. Re: Stop/Play All Sounds Too
          Level 7
          cyphernic,

          > The play / stop button I have works...but the sound
          > files continue playing.

          Heh, so does it work? ;)

          > This is the script I have:
          >
          > button1.onPress = function() {
          > MovieClip.prototype.onEnterFrame = function() {
          > // etc.

          That's a bit more complicated than you actually need, I think. Give
          this article a shot, and write back if you still have trouble. :)

          http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally


          David
          stiller (at) quip (dot) net
          Dev essays: http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Stop/Play All Sounds Too
            Level 7


            David Stiller wrote:
            > cyphernic,
            >
            >> The play / stop button I have works...but the sound
            >> files continue playing.
            >
            > Heh, so does it work? ;)
            >
            >> This is the script I have:
            >>
            >> button1.onPress = function() {
            >> MovieClip.prototype.onEnterFrame = function() {
            >> // etc.
            >
            > That's a bit more complicated than you actually need, I think. Give
            > this article a shot, and write back if you still have trouble. :)
            >
            > http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally

            Solution is simple and ok but you don't actually stop the sound, just mute
            it so it continue to play tho you just don't hear it.
            You can toggle stop start using simple boolean

            buttonName.onPress = function() {
            (playing=!playing) ? sound1.stop() : sound1.start(0, 999);

            };


            Assuming the sound was attach using something like :

            sound1 = new Sound(this);
            sound1.attachSound("loopSound");
            sound1.start(0, 999);
            • 3. Re: Stop/Play All Sounds Too
              Level 7
              urami_,

              > Solution is simple and ok but you don't actually stop the
              > sound, just mute it so it continue to play tho you just don't
              > hear it.

              True. I should have clarified, this is intended to cover timeline
              sounds as well as scripted audio. ;)


              David
              stiller (at) quip (dot) net
              Dev essays: http://www.quip.net/blog/
              "Luck is the residue of good design."