Actionscript 3.0 - Sounds

Okie! Handling sounds in AS 3.0 is so much of a bottleneck. Well its not a matter of something wrong with Adobe or the scripting language itself. But personally I just want to avoid so much trouble of declaring variables up and down just to MUTE the sounds. If only there was a simple way to do this.

So here it is. To handle sounds this is what you do. I shall give an example for you to easily understand it instead.

var vRequest:URLRequest=new URLRequest("sounds\monica_yells.mp3");
var vSound:Sound=new Sound(lRequest);
var vChannel:SoundChannel;

public function playMonica()
{
vChannel = vSound.play();
}

public function stopSound()
{
vChannel.stop();
}

public function muteSound()
{
var lTransform:SoundTransform=new SoundTransform();
lTransform.volume=1;
vChannel.soundTransform=lTransform;
}

Comments

Popular posts from this blog

Authoritative Server - MMO

Code dependencies