【发布时间】:2013-01-28 00:10:02
【问题描述】:
我的 Flash 应用程序有以下代码。本地测试时播放声音,但在 iOS 上发布时不播放。
mp3 文件位于 components/sound 目录中,该目录通过 Adobe Flash cs6 专业版中的 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)不起作用,我仍然很感激。
【问题讨论】: