4 Replies Latest reply on Jul 13, 2006 5:37 PM by Crikey

    Controlling indivual sound voulume

    Crikey
      Hi,
      I'm trying to set the voume of an individual sound via the time line without affecting the global volume. I'll explain. You're outside a house and the rain is loud, you enter the house the rain sound decreases while background elements such as music remain constant.

      I've found plenty in the forums about controlling the global volume but nothing that relates to this.

      Any help would be much appreciated.
        • 1. Re: Controlling indivual sound voulume
          Level 7


          Crikey wrote:
          > Hi,
          > I'm trying to set the voume of an individual sound via the time line without
          > affecting the global volume. I'll explain. You're outside a house and the rain
          > is loud, you enter the house the rain sound decreases while background elements
          > such as music remain constant.
          >
          > I've found plenty in the forums about controlling the global volume but
          > nothing that relates to this.

          easiest way is to make dummy movie clips.
          make one movie clip and place it off stage, empty clip.
          duplicate it as many times as you have sounds.
          give it instance name mc1 mc2 mc3 mc4 etc....

          now all you need is to define that clip as target in your sound object:

          var sound1:Sound = new Sound(mc1);
          sound1.attachSound("home");
          sound1.start(0,999);


          var sound2:Sound = new Sound(mc2);
          sound2.attachSound("hybrid");
          sound2.start(0,999);


          and simply control the volume using sound1.setVolume(10);
          sound2.setVolume(70); etc...

          pretty much it

          --
          Regards

          Urami


          --



          Happy New Year guys - all the best there is in the 2006 :)




          <urami>
          http://www.Flashfugitive.com
          </urami>

          <web junk free>
          http://www.firefox.com
          </web junk free>
          • 2. Re: Controlling indivual sound voulume
            Crikey Level 1
            Thanks Urami,

            It looks and sounds very logical, but I just can't get that to work. I can't even get the initial sound to play let alone control its volume. Am I missing something painfully obvious here?

            I've made the empty MC and assigned the script to it. Do I need the have the sound file on the stage also?

            Sorry for being a pain, but scripting is not my thing.
            • 3. Re: Controlling indivual sound voulume
              Level 7


              Crikey wrote:
              > Thanks Urami,
              >
              > It looks and sounds very logical, but I just can't get that to work. I can't
              > even get the initial sound to play let alone control its volume. Am I missing
              > something painfully obvious here?
              >
              > I've made the empty MC and assigned the script to it. Do I need the have the
              > sound file on the stage also?
              >
              > Sorry for being a pain, but scripting is not my thing.

              not to worry, not a pain :)

              open new file CTRL N, import sound (say two files)
              Once you get the sound, open the library CTRL L and assign
              LINKAGE name to each. To do it, right click first sound, go to
              LINKAGE - select the box - EXPORT FOR ACTION SCRIPT
              In the Identifier box type some name, call it Sound1

              Do the same thing with second sound, linkage, id name Sound2
              On timeline frame place:

              var s1:Sound = new Sound(mc1);
              s1.attachSound("sound1");
              s1.start(0,999);

              var s2:Sound = new Sound(mc1);
              s2.attachSound("sound2");
              s2.start(0,999);

              It will run two sounds in the same time, you can arrange the action
              as you like, it's just for the demo purpose.

              Last thing is to make the movie clip. CTRL F8 key - select movie clip.
              On top of the screen above the timeline click the "Scene 1" link to
              get out of the movie clip authoring mode.
              Again open library CTRL L and find the clip you just made.
              Drag it on stage, CTRL D to duplicate it. We need two copies.
              Now select that clip and hit CTRL F3 to open properties panel, give it
              instance name mc1 and the second clip same thing just call it mc2
              Flash does not care whether its same clip and tens of copies, it only
              refer to it by instance name and we need two to differentiate the
              targets for the sound object.

              Now if you use any volume control actions like s2.setVolume(20) or
              sound1.setVolume(70) it will apply to each sound individually.
              Using the target clip does it --> (mc1);

              Let me know if you still have problem getting it to work.




              --
              Regards

              Urami


              --



              Happy New Year guys - all the best there is in the 2006 :)




              <urami>
              http://www.Flashfugitive.com
              </urami>

              <web junk free>
              http://www.firefox.com
              </web junk free>
              • 4. Re: Controlling indivual sound voulume
                Crikey Level 1
                Thanks Urami,

                That worked great. I wasn't assigning a linkage name to the sound clip previously, so now its working fine. Thanks for your effort and your clear instructions.

                Crikey