flash - 在Flex(Flash)中播放声音却听不到任何声音

标签 flash actionscript-3 apache-flex audio

老鼠!

我正在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/

相关文章:

apache-flex - 弹性 3 : dynamically created checkbox column in datagrid - data population issues and event listener

apache-flex - Flex ArrayCollection 按属性值检测重复项

android - Android 上的 JW Player 无法播放视频

javascript - 如何创建流程图? JavaScript 还是 Flash?

actionscript-3 - 大小为 -1 的向量会导致 Flash 播放器崩溃且没有错误处理

flash - 多个音频到netStream?

html - YouTube 电影无法加载

apache-flex - Maven 版本 :perform seems to break build-helper:add-source

actionscript-3 - 是否有可能通过以编程方式高速移动物体来获得 "blur motion"

apache-flex - 使用 ViewStack 的 Flex 动态选项卡