Last post I started with the basic of dynamic sound in flash. Now we will do something more pratical with what we saw. We will create a piano that play notes by clicking or pressing keys.
I will not spend time creating the piano, so you can download it here.
This movie requires Flash Player 9
OK, starting here, we need to create a sound instance, a soundChannel instance, add the listeners and play the sound.
private var sound:Sound; private var channel:SoundChannel; public function Main():void{ init(); sound = new Sound(); sound.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData); channel = sound.play(); } private function onSampleData(e:SampleDataEvent):void{ }
English
