Q:

Actionscript 3 - Test if URLRequest fails

I have a music player that loads 2 files, and then plays the 2 files on 2 separate soundchannels.  I need to test to see if the 2nd music file is able to load, and then let the play controls check for this to determine how many sound channels to play.  Can I do something like:
var soundFile2:URLRequest = new URLRequest("mp3Player/king.mp3");
....
myMusic2.load(soundFile2, myContext);
if (soundFile2 != null){
    channel2 = myMusic2.play(channel.position);
    }

A:

You need to add event listeners, for an Event.COMPLETE and for an IOErrorEvent.IO_ERROR:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Sound.html#includeExamplesSummary
Loading files is asynchronous, so you can't check for a result on the line after the load call in your code example, you have to wait for a response that comes at a later time, by using an event listener.

