1 Reply Latest reply on Apr 18, 2006 3:17 PM by Wolf_van_Ween

    setVolume() on multiple sound objects?

    cctman1 Level 1
      I have a scene where I'm trying to set differ volumes on differ sound objects based on actionscript params. However when I do a set Volume() on one sound object it applies the same volume to all sound objects within my scene. Is this normal behavior? If it is is thee a work around?


      before someone asks I need to add this code because I am targeting only one sound object and not all in my scene.

      var roll_sound:Sound = new Sound();
      roll_sound.attachSound("rollover1");
      var ambient_sound:Sound = new Sound();
      ambient_sound.attachSound("ambient");

      function lowerSound(){
      this.onEnterFrame = function(){
      ambient_sound.setVolume(ambVol);
      if(ambVol <> lowAmbVol){
      --ambVol;
      }else{
      delete this.onEnterFrame;
      trace("delete my frame");
      }
      }
      }

      In my code above when I hit lowerSound() method only ambient_sound. should be getting affected but all of my sound objects in my scene are instead...

      -Thanks in advance!
        • 1. Re: setVolume() on multiple sound objects?
          Wolf_van_Ween Level 1
          This is normal behaviour albeit very difficult to understand.
          Even though volume and pan are properties of the Sound object, they seem to be shared across all Sound class objects of the same parent.
          In other words, if you want to change only a single sound's volume, you need to assure this sound its own parent with a createEmptyMovieClip.