ios - Air iOS,Flash Pro,外接mp3无法播放

标签 ios flash audio air mp3

我的 Flash 应用程序具有以下代码。在本地测试时会播放声音,但在 iOS 上发布时不会播放。

mp3 文件在 components/sound 目录下,该目录通过 Adob​​e Flash cs6 professional 中的 Air iOS3.6 发布设置包含。

我做了一些测试,虽然 mp3 文件和目录在 iOS 中存在(使用 File.exists 测试),但 sound.bytesLoaded 显示 0 值。在本地测试时,它显示实际文件大小。

谁能帮我解决这个问题?

var path= File.applicationDirectory.resolvePath("components/sound/click.mp3").nativePath;
var sound = new Sound(new URLRequest(path));
sound.play();

[编辑]

当我简单地将 new URLRequest(path) 替换为 new URLRequest("components/sound/click.mp3") 时它起作用了。

但是,如果有人能解释为什么前一个 (nativePath) 不起作用,我将不胜感激。

最佳答案

阅读 this thread on Adobe Community forums关于在 iOS 上加载外部声音,您的代码似乎没问题,我看到的唯一可疑之处是您应该以“/”开头的文件路径,例如:

var path= File.applicationDirectory.resolvePath("/components/sound/click.mp3").nativePath;

希望这对您有所帮助!

关于ios - Air iOS,Flash Pro,外接mp3无法播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14836744/

相关文章:

actionscript-3 - 闪存 CS5 : compiling fla with huge internal library takes YEARS !

apache-flex - 强制编译时链接 SWC 中的所有类

javascript - 打开 Flash Chart 2 IE 不加载图表的新数据

swift - 在 Swift 中产生不同频率的声音

c# - 用户单击图标时如何在wp7中播放声音

ios - 所有行在每个部分标题下重复

iphone - 当 XML 数据根据输入的数据返回两个不同的类别时,如何解析 XML 数据?

actionscript-3 - AS3 : Recording sound as they are output/played

ios - 在 NavigationView 前面放置可交互的 View 隐藏导航栏

iOS 自动布局 : button. 约束不返回所有约束