2 Replies Latest reply on Apr 19, 2006 1:39 PM by MrMacey

    on/off mute sound

    mrmille
      This topic have been up here before, i know. However, noone of them have solved my problem

      I got this simple player drawn in photoshop. All buttons are included in this file, thus i just create some rectangles and make them transparent. Theese rectangles are the buttons.

      Anyway, the clip is dropped into the cast and plays without any problems, its called "laroxa". The mute button will mute the sound but not enable it again.

      The code
      ---------------
      property pMute

      on beginSprite me
      pMute=0
      end

      on mouseUp me
      if pMute=0 then
      sprite("laroxa").volume=0
      pMute=1
      alert("off")
      else
      sprite("laroxa").volume=255
      pMute=0
      alert("on")
      end if

      end

      ----

      Its wierd =(
        • 1. Re: on/off mute sound
          James Newton, ACP Level 3
          Your code works for me. Here are my steps:

          1. I created a new movie
          2. I imported an MPEG1 movie
          3. I dropped the movie on the Stage
          4. I named the movie sprite "laroxa"
          5. I created a new behavior
          6. I pasted your code into the behavior
          7. I dropped the behavior onto the movie sprite

          I then ran the movie and clicked on the movie sprite. The sound switched on and off as expected.
          • 2. Re: on/off mute sound
            MrMacey
            I found this one this forum a while ago, it worked for me i have a loop in channel 1, just put it on your mute button....


            global gOldVol

            on startMovie me
            if gOldVol=void then gOldVol=0
            end

            on mouseUp me
            if sound(1).volume>0 then
            gOldVol=sound(1).volume
            sound(1).volume=0
            else
            sound(1).volume=gOldVol
            end if
            end