Monday, April 25, 2011

Drum Sound in Flash

Putting a drum sound in flash is quite easy actually. But for me the challenge thing is to call out the drum sound using AS3. Luckily the experimental period is quite smooth. First, I import the packages that will be using in flash like below:


import flash.media.Sound;
import flash.media.SoundChannel;


After that, put the following action script under the private KeyPress function:


var my_sound:drumsound = new drumsound();
var my_channel:SoundChannel = new SoundChannel();

if (event.keyCode==Keyboard.SPACE) {
my_channel = my_sound.play();
}


Its done! Drum sound will come out when SPACE bar is press. Its time for final set up!!!!

No comments:

Post a Comment