Flash AS3 | July 29, 2009

Adding and Manipulating Sound in AS3

For some reason I had a really tough time finding a quick and easy tutorial on how to add a .mp3 to to an AS3 project and lower the volume.

First, import your .mp3 to the library and set a linkage classname.

Linkage Screenshot

Right click on the .mp3 you have imported to your library and select 'Linkage'. Essentially, this allows you to address the .mp3 as a class.

You can then address it with the following code:

var snd:neonstart4 = new neonstart4();
var sc:SoundChannel = snd.play();
var st:SoundTransform = sc.soundTransform;
st.volume = .2; // set to 20% volume
sc.soundTransform = st;
Marple: the body in the library download movie Sicko download movie Roanoke: the lost colony download movie Marple: the body in the library download movie Sicko download movie Roanoke: the lost colony download movie The burbs download movie The mummy s ghost download movie 10 items or less download movie Evil bong download movie Boot camp download movie Grind download movie Blur download movie Confessions of a pop performer download movie