apache-flex - 不支持的采样 flex/actionscript

标签 apache-flex actionscript-3 mxml mxmlc

在我需要的 ActionScript 中

  Loading configuration file /opt/flex/frameworks/flex-config.xml
  t3.mxml(10): Error: unsupported sampling rate (24000Hz)

        [Embed(source="music.mp3")]

     t3.mxml(10): Error: Unable to transcode music.mp3.

        [Embed(source="music.mp3")]

代码是
         <?xml version="1.0"?>
   <!-- embed/EmbedSound.mxml -->
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

  <mx:Script>
    <![CDATA[

        import flash.media.*; 

        [Embed(source="sample.mp3")]
        [Bindable]
        public var sndCls:Class;

        public var snd:Sound = new sndCls() as Sound; 
        public var sndChannel:SoundChannel;

        public function playSound():void {
            sndChannel=snd.play();
        }   

        public function stopSound():void {
            sndChannel.stop();
        }   
    ]]>
</mx:Script>

<mx:HBox>
    <mx:Button label="play" click="playSound();"/>
    <mx:Button label="stop" click="stopSound();"/>
</mx:HBox>
</mx:Application>

最佳答案

来自 livedocs :

"Flash can import either 8- or 16-bit sounds at sample rates of 11, 22, or 44 kHz. Sounds recorded in formats that are not multiples of 11 kHz (such as 8, 32, or 96 kHz) are resampled when imported into Flash. Flash can convert sounds to lower sample rates on export."


Flex Builder 不会为您执行此操作,因此您需要在使用前手动将“music.mp3”文件降采样到 22kHz。
编辑:
我找不到合适的文档,但 here它说:

"Sound Sample Rate - measured in Hz, this is fixed when the sound file is first recorded, and Flash .SWF files only allow four rates.

The Flash SWF format has sampling rates of:

5500 Hz

11025 Hz

22050 Hz

44100 Hz (preferred setting)"

关于apache-flex - 不支持的采样 flex/actionscript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4690285/

相关文章:

apache-flex - 如何从同时播放的所有声音中获取声音数据? ( ActionScript 闪烁)

apache-flex - Flex 脚本文件中的默认命名空间范围警告 (1084)

apache-flex - 从TextInput扩展组件时出现Flex MXML错误

apache-flex - 如何在 flex 网格中合并列标题,类似于 html 中的 colspan?

apache-flex - 处理 AIR 应用程序中的应用程序退出事件

actionscript-3 - 在 AS3 中保存/加载文件的一些好方法是什么?

actionscript-3 - 在 Flex 中定义属性的可能值

flash - 字节数组到字符串

apache-flex - Flex应用程序可以在移动设备上运行吗?

actionscript-3 - 如何在 AS3 中停止同时浏览器和 SWF 鼠标滚轮滚动?