Actionscript 3 未定义的方法通过带有静态类型flash的引用从ByteArray加载CompressedDataFromByteArray。媒体:声音
我读书。我真的很想这么做 来自adobe: 我的代码:Actionscript 3 未定义的方法通过带有静态类型flash的引用从ByteArray加载CompressedDataFromByteArray。媒体:声音,actionscript-3,flash,Actionscript 3,Flash,我读书。我真的很想这么做 来自adobe: 我的代码: private function playBase64(content:String):void { var mp3Bytes:ByteArray; var mp3Sound:Sound = new Sound(); mp3Bytes = Base64.decodeToByteArray(content); mp3Bytes.position = 0; mp3Sound.loadCompressedDataFromByt
private function playBase64(content:String):void {
var mp3Bytes:ByteArray;
var mp3Sound:Sound = new Sound();
mp3Bytes = Base64.decodeToByteArray(content);
mp3Bytes.position = 0;
mp3Sound.loadCompressedDataFromByteArray(mp3Bytes, mp3Bytes.length);
mp3Sound.play();
}
但我得到:
Warning: Running "mxmlc:all" (mxmlc) task
>> Error: Command failed: /Users/michaeljin/git/yinlang/training/node_modules/flex-sdk/lib/flex_sdk/bin/mxmlc -debug=true -optimize=true -library-path=client/assets/flash/libs -output client/assets/flash/YLSoundPlayer.swf -- client/assets/flash/YLSoundPlayer.as
>> /Users/michaeljin/git/yinlang/training/client/assets/flash/YLSoundPlayer.as(59): col: 16 Error: Call to a possibly undefined method loadCompressedDataFromByteArray through a reference with static type flash.media:Sound.
>>
>> mp3Sound.loadCompressedDataFromByteArray(mp3Bytes, mp3Bytes.length);
>> ^
Warning: FAILED Use --force to continue.
Aborted due to warnings.
编辑:发现它适用于mxmlc 4.6,但不适用于4.0您的目标是FP版本<11,目标是Flash Player 11,至少要有此方法可用。如果您从函数文档中引用您认为相关的内容,这将很有帮助,毕竟文本并不比你发布的链接长多少…我认为adobe在文档中显示的方法是存在的。但这对我不起作用。也许你编码的字符串没有解码成有效的MP3?Flash支持的MP3转换为
声音
对象的功能有限制。