老鼠!
我正在Flex中播放by-the-book声音,但听不到。
我尝试了这个:
var snd : Sound = new Sound();
snd.addEventListener(Event.COMPLETE, function(e : Event) : void
{
snd.play();
});
snd.addEventListener(IOErrorEvent.IO_ERROR, function(e : IOErrorEvent) : void
{
Log.format("Playing gong sound failed...\n{0}", e.toString());
});
snd.load(new URLRequest("http://localhost:8000/gong.wav"));
我尝试了更简单的方法:
var snd : Sound = new Sound(new URLRequest("http://localhost:8000/gong.wav"));
snd.play();
但是我什么也没听到。在vlc中启动相同的mp3文件可以正常运行。是的,我的扬声器已打开。 :)
不是负载。我可以看到它实际上正在加载这40k字节,如果输入错误的URL,我和会收到IOError。好像在玩,但是什么也听不见。
最佳答案
来自flex文档中的“Working with Sound”:
Although there are various sound file formats used to encode digital audio, ActionScript 3.0, Flash Player and AIR support sound files that are stored in the mp3 format. They cannot directly load or play sound files in other formats like WAV or AIFF.
确定要播放mp3吗?您的网址显示为“.wav” ...
关于flash - 在Flex(Flash)中播放声音却听不到任何声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8929874/