2 Replies Latest reply on Feb 14, 2007 6:51 AM by VC727

    Volume control button

    helpLaura Level 1
      I have added sound into a game i am making, however can someone assist me in making a volume control buttton?
        • 1. Re: Volume control button
          kglad Adobe Community Professional & MVP
          use the sound class to create your sound. you can then use the sound class methods (like setVolume() ) to control your sound's volume and attachSound() and start() to start your sound playing.
          • 2. Re: Volume control button
            VC727
            This is how I set up a sliding volume controller (a ball to click and drag across a line to increase/decrease volume)...
            You will have to adjust though for the length of your line.


            //SOUND OBJECT
            var soundtrack:Sound = new Sound;
            soundtrack.setVolume(100);
            //END OF SOUND OBJECT

            //GLOBAL VOLUME CONTROL
            var nVolCheck:Number;
            volSlider.volBall.onPress = function():Void {
            this.startDrag (false, 0, 0, 75, 0);
            nVolCheck = setInterval(updateVolume, 150);
            };
            volSlider.volBall.onRelease = function():Void {
            this.stopDrag ();
            clearInterval(nVolCheck);
            };
            function updateVolume():Void {
            var vol:Number = (volSlider.volBall._x)*2;
            soundtrack.setVolume(vol);
            };
            //END OF GLOBAL VOLUME CONTROL