Hi there Everyone! I have a very basic problem with sound.
Here is my problem:
I have an swf file which has a sound loaded in the library. It might or might not have another sound in the same directory. So what I would like the swf to do is:
if there is a sound file in the directory then play it
if there is no sound in the directory then play the one in the library.
My code looks like this:
var punchSoundReq:URLRequest;
var soundPunch:Sound;
punchSoundReq = new URLRequest("punch.mp3");
if (punchSoundReq){
soundPunch=new Sound(punchSoundReq);
soundPunch.play();
} else {
var punchSound:Punch = new Punch();
punchSound.play();
}
Of course I keep getting error message if I the punch.mp3 does not exist in the directory. What I tried to do with the if statement is to check wether the file exists…but obviously my solution does not work (because the URLRequest will be always true). How could I check for the sound file if exists?
Thank you for your help in advance!