I see a lot of guides that do something like this:
var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel(); //unnecessary allocation?
myChannel = mySound.play();
Is allocating a new SoundChannel() in the second line completely unnecessary? From the docs, it seems that Sound.play
generates a new SoundChannel every time, so you're not forcing it to use that SoundChannel that was just allocated, right? What the second line actually does is allocate a new SoundChannel, which does nothing, and assigns the variable myChannel to it. Then in the third line, mySound.play() generates a new SoundChannel and makes myChannel point to it instead, leaving the first SoundChannel inaccessible.
Should the second line just be this?
var myChannel:SoundChannel;
There are several guides which seem to do that unnecessary allocation, including an example in the official docs.