;

PDA

Click to See Complete Forum and Search --> : Up volume button


TerryE
05-26-2009, 10:42 PM
I have a button that starts and sets the volume of a song but I can figure on how to increase the volume when you click the button.

function soundPage(event:MouseEvent):void {
var n:Number = .1;
var song:Sound = new coanan;
var channel:SoundChannel;
channel = song.play();
var vol:SoundTransform = new SoundTransform;
vol.volume=n;
channel.soundTransform = vol;
sound_mc.gotoAndPlay("rollout");
sound_an.gotoAndPlay("rollout");

}
up_ro.addEventListener(MouseEvent.CLICK , upPage);
function upPage(event:MouseEvent):void {
//what code goes here//
up_mc.gotoAndPlay("rollout");
up_an.gotoAndPlay("rollout");

}

cancerinform
05-27-2009, 12:47 AM
Use the SoundTransform class. If channel is the SoundChannel instance then you can change the volume by this:

var transform:SoundTransform = channel.soundTransform;
transform.volume = volume;