Search code examples
flashair

Air on MAC returns file not found


I am working on an AIR app that needs to get an image from the filesystem. It determines the path to the image based on a configuration file loaded beforehand.

The issue is that on Windows, it works just fine. But on MAC, I am getting an error #2035, file not found.

Here is the code I am using to load the image:

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));

According to the client, the path being shown in the error message is correct: '/Users/Lachlan/Desktop/release/images/aisle_1.jpg'

Is there some other way I should be attempting to access the file in this situation?

lee


Solution

  • You should try with url property of File Class instead of nativePath.

    In generally Mac require file protocol to acccess file like file:///

        L.load(new URLRequest(File.desktopDirectory.resolvePath(this.asset_path + this.asset_xml.@image_name).url));