开发者

Audio not playing in Flash AS3

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 wh开发者_运维技巧ile 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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜