Tuesday, 11 October 2011
sound channels in actionscript
been playing with sound channels. something clicked and i feel i understand it a lot better than before. (ie; none.) I've used colours so you can see which parts refer to which.
var drumming:Sound = new blob();
assigns sound to variable 'drumming'. 'blob' is the name of the sound in this case.
var drummingchannel:SoundChannel = new SoundChannel();
creates the sound channel 'drummingchannel'
drum2.addEventListener(MouseEvent.MOUSE_DOWN, playsound);
assigns the function 'playsound' to event a mouse event, which in turn is connected to the movie clip 'drum2'
function playsound (Event:MouseEvent):void{
drummingchannel = drumming.play();
}
makes the function 'playsound' access the channel 'drummingchannel' and play the sound (blob) assigned to the variable 'drumming'.
so there y'are.
Subscribe to:
Posts (Atom)