Is it possible to load a WAV file into an AS3 project ( Flex
2 SDK ) and get it to play using the Sound class?
I have tried a few different things such as trying to [Embed]
the WAV file (pretty obvious that one wouldn't work), loading in
the WAV file via the ByteArray class, and so on. Surely there must
be a way of doing this without having to manually add the WAV files
into an SWF library?
In a nutshell: You need to load the WAV file as binary data,
use the ByteArray class to wrap the raw sound data in SWF bytecode,
and then use the Loader.loadBytes method to convert the SWF
bytecode into something that Flash can use. The WAV sound is then
available from that SWF file's library and can be played with the
It wasn't the easiest thing in the world to figure out, but
it works. :-)