0

我正在开发一个需要从文件系统获取图像的 AIR 应用程序。它根据预先加载的配置文件确定图像的路径。

问题是在 Windows 上,它工作得很好。但在 MAC 上,我收到错误 #2035,找不到文件。

这是我用来加载图像的代码:

var L:Loader = new Loader();
        L.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);
        L.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
        L.load(new URLRequest(File.desktopDirectory.resolvePath(this.asset_path + this.asset_xml.@image_name).nativePath));

根据客户的说法,错误消息中显示的路径是正确的:'/Users/Lachlan/Desktop/release/images/aisle_1.jpg'

在这种情况下,我应该尝试以其他方式访问文件吗?

4

1 回答 1

0

您应该尝试使用urlFile Class 的属性而不是 nativePath。

通常 Mac 需要文件协议来访问文件,例如file:///

    L.load(new URLRequest(File.desktopDirectory.resolvePath(this.asset_path + this.asset_xml.@image_name).url));
于 2013-03-04T08:55:18.200 回答