# As 3.0 volume functions not working

**URL:** <https://forum.kirupa.com/t/as-3-0-volume-functions-not-working/319355>\
**Category:** Uncategorized\
**Created:** [February 17, 2011, 9:54am UTC](https://forum.kirupa.com/t/as-3-0-volume-functions-not-working/319355 "2011-02-17T09:54:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthik5025](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@karthik5025](https://forum.kirupa.com/u/karthik5025)\
**Post date:** [February 17, 2011, 9:54am UTC](https://forum.kirupa.com/t/as-3-0-volume-functions-not-working/319355/1 "2011-02-17T09:54:02Z")

</div>

I amnew to as 3.0.This is the code am using to create a mp3 player,everything is fine but the volume controls,not able to mute or increase the volume,kindly tell whats wrong in the code

[COLOR=Blue]import flash.media.Sound;  
import flash.media.SoundChannel;  
import flash.media.SoundTransform;  
import flash.media.SoundMixer;  
import flash.net.URLRequest;

var soundRequest:URLRequest=new URLRequest(“Ennamo Aedho.mp3”);  
var sound:Sound=new Sound();  
var sc:SoundChannel = new SoundChannel();  
var st:SoundTransform=new SoundTransform(0.1);  
var lastPosition:Number=0;  
sound.load(soundRequest);  
sound.addEventListener(Event.ID3, id3Loaded);

btn\_play.addEventListener(MouseEvent.CLICK, playfunc);  
btn\_stop.addEventListener(MouseEvent.CLICK, stopfunc);  
btn\_volup.addEventListener(MouseEvent.CLICK, increasevol);  
btn\_pause.addEventListener(MouseEvent.CLICK, onClickPause);  
btn\_mute.addEventListener(MouseEvent.CLICK, mute);

function playfunc( event:MouseEvent):void {  
sc=sound.play(lastPosition);  
}

function mute( event:MouseEvent):void {  
sc.soundTransform=st;  
st.volume=0.1;  
}

function stopfunc( event:MouseEvent):void {  
sc.stop();  
lastPosition=0;  
}

function increasevol ( event:MouseEvent):void  
{  
st.volume -= 0.1;

sc.soundTransform = st;  
}

function onClickPause(e:MouseEvent):void {  
lastPosition=sc.position;  
sc.stop();  
}

function id3Loaded(event:Event):void {  
album.text=sound.id3.album;  
song.text=sound.id3.songName;  
artist.text=sound.id3.year;  
}[/COLOR]
