5 Replies Latest reply on May 5, 2006 6:55 AM by Newsgroup_User

    Turn Sound Off

    sprackles Level 1
      I am making a small animation in my project that uses the sound clip of a train. This clip may be shown many times so it may get a little annoying after a wile. To counter this I want to make a button that will turn this one sound clip off. I was hoping someone could help me with the code for this button? Any help would be greatly appreciated.

      I have videos in this project as well so I am just looking to turn this one sound clip off rather than all the sound in the project
        • 1. Re: Turn Sound Off
          Level 7
          sprecks1 wrote:
          > I am making a small animation in my project that uses the sound clip of a
          > train. This clip may be shown many times so it may get a little annoying after
          > a wile. To counter this I want to make a button that will turn this one sound
          > clip off. I was hoping someone could help me with the code for this button?
          > Any help would be greatly appreciated.
          >
          > I have videos in this project as well so I am just looking to turn this one
          > sound clip off rather than all the sound in the project
          >
          if you create a sound object with the clip who'd sound you want to
          control as the argument, you can switch sound of for just that clip e.g.
          var soundControl = new Sound(this.train_animation_mc);
          soundControl.setVolume(0);

          --
          MOLOKO
          Macromedia Certified Flash MX 2004 Developer
          Macromedia Certified Flash MX Developer
          ------------------------------------------------
          ::remove _underwear_ to reply::
          'There ain't no devil - it's just God when he's drunk' Tom Waits
          ------------------------------------------------
          GCM/CS/IT/MC d-- S++:- a- C++ U--- P+ L++ !E W+++$ N++ O? K+ w+++$ !O M+
          VMS? PS+++ PE- Y PGP+ t+ 5-- X-- R* tv++ b++++ DI++++ D+ G e h-- r+ y++
          • 2. Re: Turn Sound Off
            sprackles Level 1
            i think i have a grasp of wot u mean, i'll give it a go, cheers mate
            • 3. Re: Turn Sound Off
              sprackles Level 1
              i think i have a grasp of wot u mean, i'll give it a go, cheers mate
              • 4. Re: Turn Sound Off
                sprackles Level 1
                i forgot to say... I have used the sound on several clips and wanted to take it out of all of them, I've used this variable, which I think should work rather than taking the sound out of a single clip,

                var soundControl = new Sound (trains.wav)
                soundControl.setVolume(0)

                but I'm not sure how to actually call it, my Action Scripting is unfortunately very minimal, could u please suggest a piece of code before this to call the variable?
                • 5. Re: Turn Sound Off
                  Level 7
                  sprecks1 wrote:
                  > i forgot to say... I have used the sound on several clips and wanted to take it
                  > out of all of them, I've used this variable, which I think should work rather
                  > than taking the sound out of a single clip,
                  >
                  > var soundControl = new Sound (trains.wav)
                  > soundControl.setVolume(0)
                  >
                  > but I'm not sure how to actually call it, my Action Scripting is unfortunately
                  > very minimal, could u please suggest a piece of code before this to call the
                  > variable?
                  >
                  Oh OK, if you want a global volume control, you give it an argument of
                  '_root' and you can store a reference to it in _global so that you can
                  access it from anywhere. so, on frame 1 of your flash, do this:
                  _global.sound_control = new Sound(_root);

                  then to mute to volume from wherever you like you call:
                  _global.sound_control.setVolume(0);

                  so for example if you had a button called 'mute_btn':
                  this.mute_btn.onRelease = function()
                  {
                  _global.sound_control.setVolume(0);
                  }

                  --
                  MOLOKO
                  Macromedia Certified Flash MX 2004 Developer
                  Macromedia Certified Flash MX Developer
                  ------------------------------------------------
                  ::remove _underwear_ to reply::
                  'There ain't no devil - it's just God when he's drunk' Tom Waits
                  ------------------------------------------------
                  GCM/CS/IT/MC d-- S++:- a- C++ U--- P+ L++ !E W+++$ N++ O? K+ w+++$ !O M+
                  VMS? PS+++ PE- Y PGP+ t+ 5-- X-- R* tv++ b++++ DI++++ D+ G e h-- r+ y++