Adding embedded sounds via AS3

AS3 has this nasty habit of not playing sounds you put on timelines of embedded clips how you might like. They might start at random times when other things’re playing, play on frames with no sound, no real end to all the crazy things it might do.

Safer to use actionscript directly to add the sound to where you want it, rather than adding it to the timeline directly.

Lifted directly off Livedocs:

var drum:DrumSound = new DrumSound();
var channel:SoundChannel = drum.play();

Where ‘DrumSound’ is what you’ve ‘exported for actionscript’ your soundfile as (the sounds class)

Tech Reference:

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑