2 Replies Latest reply on Apr 6, 2010 6:40 AM by kglad

    setVolume problem

    Pooya Source

      hi

      I tried to control a background music volume using this code

       

      soundInstance = new Sound();

      soundInstance.attachSound("1");

      soundInstance.start(0,999);

      _root.soundInstance.setVolume(10);

      here attachSound("1");

       

      "1" is a linkage identifier. everything works perfect...music plays and volume decreases.

      but not only the attached sound... the whole movie volume changes even the swf I've loaded in my clip. I just need to control the background music("1" linkage) not all the sounds. what's the problem here? how can I make this happen?

       

      thank you

        • 1. Re: setVolume problem
          kglad Adobe Community Professional & MVP

          each sound is associated with a movieclip.  unless you explicitly use the movieclip in your sound constructor, the current timeline is used and your sound instance will control all sounds on the current timeline.

           

          to remedy, create a movieclilp to associate with each sound:

           

          this.createEmptyMovieClip("soundInstanceMC",this.getNextHighestDepth());

          soundInstance=new Sound(soundInstanceMC);

          //etc

          • 2. Re: setVolume problem
            d0brin Level 1

            a simplier solution to this is to create a movie clip with sound control system for the BG music and that way it will not affect the rest of the sounds in your .swf

            1 person found this helpful