如何在 adobe air 中从磁盘加载外部文件? (Android)

How to load an external file from disk in adobe air? (Android)

我想在 Android 上加载 /mnt/sdcard/audio.mp3 并在 Windows

上加载 C:\Users\username\Documents

此代码适用于 Windows

On Android 从不调用 try_add_callbacks 并且 header

中不显示任何错误消息
try
{
    header.text="???";
    header.text=File.documentsDirectory.nativePath;

    var sound:Sound;
    sound.addEventListener(Event.COMPLETE,try_add_callbacks);
    sound.load(new URLRequest(File.documentsDirectory.nativePath+"/audio.mp3"));
}
catch(error:Error)
{
    header.text=error.errorID+" "+error.message;
}

我用AIR 3.4 for Android

File.documentsDirectory.nativePath 应替换为 File.documentsDirectory.url

该应用在 Windows 上运行,因为它可以将本机路径识别为 url。

感谢BotMaster