Skip to main content
Participant
September 28, 2016
Question

I/O Error when loading an image with Loader from unmapped network address

  • September 28, 2016
  • 2 replies
  • 442 views

We have this code in an AIR application:

  

var name:String = "file://networkfileserver/folder/image.png";

var _loader:Loader = new Loader();

   _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);
   _loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
   _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
   var loaderContext:LoaderContext = new LoaderContext();
   loaderContext.imageDecodingPolicy = ImageDecodingPolicy.ON_LOAD;
   _loader.load(new URLRequest(name),loaderContext);

This causes an IO Error with message Error #2035: URL Not Found. URL: file://networkfileserver/folder/image.png

Opening this very same address in a browser results in the image being shown (it gets converted into file://///networkfileserver/folder/image.png in Firefox, but it is still shown).

If we map the network folder, the image is loaded in AIR as well (as "file://Z:/image.png" for instance, which gets converted to "file:///Z:/image.png" in Firefox, not any other browser, but works in all of them).


If this was due to authentication issues, I would expect "file://networkfileserver/folder/image.png" to throw a security error, not an i/o one, and also for it not to load in any browser.

I tried adding a crossdomain.xml and a loaderContext.checkPolicyFile = true; just in case, to no avail.

Any tips will be greatly welcome.

Thanks!

This topic has been closed for replies.

2 replies

Participant
September 29, 2016

Hi. Yes, but the same code runs in Flash Player (web).http://stackoverflow.com/a/7915741/483088

In any case, nevermind: Accessing a shared folder over a network in adobe air - Stack Overflow

So this is what I was looking for: "file:///\\networkfileserver\folder\image.png"

kglad
Community Expert
Community Expert
September 28, 2016

is that an air for desktop app?