views:

15

answers:

1

Hi guys,

I've been trying to play an external sound file in Flash and failing miserably.

The code couldn't be simpler:

var s:Sound = new Sound();
var req:URLRequest = new URLRequest(MovieClip(root).videoLink);
var context:SoundLoaderContext = new SoundLoaderContext(3000, true);
s.load(req, context);
var my_channel:SoundChannel;
my_channel = s.play(0);

videoLink is a string containing a valid link to a WAV file on the same server.

The problem with this code is, I can only run it while it's on a live server (the link is obtained from a MySQL database via XML), so I can't tell if any error when it's being run. Then again, I can't see how the above code can lead to any problems.

I've spent more than 2 hours trying different solutions. Any help would be greatly appreciated.

Andrey

+1  A: 

Your sound file should be a mp3 , not a wav. try the same code with an mp3 version and it should play.

Check this article, for info on how to play wav files with as3
http://richapps.de/?p=97

PatrickS
YES. Obviously it had to be something simple like that. Thank you for your help!
Andrey