AS3 Sound Sequencer


Well in my first post I hinted that it was related to another tool that I was going to share.

Well here it is, this is my AS3 Sound Sequencer. This bit of script in conjuncture with Matt Przybylski’s Sound Manager allows you to string a few sounds together with optional delays between them and giving you the ability to pause or stop it at will.

//method #1:
var soundSequence:SoundSequence = new SoundSequence('sound1', 'sound2', 5000, 'sound3');

//method #2:
var soundArray:Array = ['sound1', 'sound2', 5000, 'sound3']
var soundSequence:SoundSequence = new SoundSequence();
soundSequence.sequenceFromArray( soundArray );

//method #3:
var soundSequence:SoundSequence = new SoundSequence();

// To start any above method:
soundSequence.playSequence() // will play SoundManager's 'sound1' ID-ed sound1, then sound2, then 5 second gap, then sound3

soundSequence.stopSequence() // will stop the sound sequence

soundSequence.pauseSequence() // pauses

soundSequence.resumeSequence() // resumes

soundSequence.addEventListener(Event.COMPLETE, onSoundSequenceComplete) // if you want to know when it is finished playing.

Here is a live demo, click though the accordion slices to mess around with the delay or omit a sound all together.

the example source

  • Socialflasher

    how do i add library sounds in it ?