3 Replies Latest reply on Apr 13, 2009 8:36 AM by kglad

    Need ur help! Mute and Hide movie clips, any flash wizards know the answer?

      Im trying to create movie clips that, when clicked on, will hide the animation and mute the sound.

      Its important that they are hidden and not stopped as all my movie clips are synchronized.

      I take it i need to combine visibility and volume in the code but just cant seem to get it right!

      Hope someone can please point me in the right direction. Been pulling my hair out for the past week!

      Thanks,
      Jen



      This is the code ive got so far.

      var song_sound:Sound = new Sound();
      song_sound.attachSound("drums");

      song_sound.start(0,999);

      song_sound.setVolume(0)

      drums_mc._visible = false

      play_btn.onPress = function()
      {if(sound==1)s.setVolume(0);
      sound = 0;
      if(drums_mc._visible = false; ) drums_mc._visible = true

      else if(sound==0){s.setVolume(100);
      sound = 1;
      else if(drums_mc._visible = true; ) drums_mc._visible = false}

        • 1. Re: Need ur help! Mute and Hide movie clips, any flash wizards know the answer?
          kglad Adobe Community Professional & MVP

          you can use the _visible property of movieclips to hide and unhide movieclips and you can use the stopAllSounds() function to stop all sounds.

           

          also, in your if-statements, you must use the double equal (==) to check for equality.  otherwise, you're changing the _visible property in your if-statements.  you have some other errors, too:

           

           

           

           

           

           

          song_sound.setVolume(0)
          
          drums_mc._visible = false
          
          play_btn.onPress = function(){
          if(song_sound.getVolume()==100){  // assuming you want something like a volume toggle
          song_sound.setVolume(0);
          } else {
          song_sound.setVolume(100);
          }
          //if(drums_mc._visible == false; ){
          if(drums_mc._visible == false){
          drums_mc._visible = true } else{ drums_mc._visible = false; } }
          1 person found this helpful
          • 2. Re: Need ur help! Mute and Hide movie clips, any flash wizards know the answer?
            Level 1

            Brilliant! thanks so much for ur help unfortunatley im still getting these error msg's

             

            ')' expected                                                  if(drums_mc._visible == false; ){                            Line 18

            Unexpected '}' encountered                           } else{                                                                 Line 20

             

            (Btw, I need to use the volume rather than stop all sounds as there will be other movie clips with sounds in the same frame)

            • 3. Re: Need ur help! Mute and Hide movie clips, any flash wizards know the answer?
              kglad Adobe Community Professional & MVP

              there should be no semi-colon inside the if-statement paranthesis:

               

               

               if(drums_mc._visible == false){