David Smith
David Smith

Reputation: 105

Error #2044: Unhandled IOErrorEvent:. Flash AS3

trying to see why I get this error every time I run this small piece of code in Flash!

the error: Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

the code:

import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;

var xmlLoader:URLLoader;
var xml:XML;

var uRequest = new URLRequest("http://xxxxxxx/app.php");
xmlLoader = new URLLoader(uRequest);
xmlLoader.addEventListener(Event.COMPLETE, onXMLLoad);
var imgLoader:Loader;

function onXMLLoad(e:Event) {
    xml = new XML(e.target.data);
    imgLoader = new Loader();
    imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImgLoaded);
    imgLoader.load(new URLRequest(xml.Data.Image.text()[0]));
}

function onImgLoaded(e:Event) {
    addChild(imgLoader);
}

The XXXXXXX is the url to my site by the way.

I just can find the reason why this error is getting spat out as I checked the URL a few times and it is correct URL.

Upvotes: 2

Views: 7609

Answers (2)

David Smith
David Smith

Reputation: 105

All i needed to do was to change the settings and how the URL's was showing in my XML file.

I had to change the /images/image1.jpg to the full path like so: http://mysite.com//images/image1.jpg and this works fine.

Upvotes: 0

Adrian Pirvulescu
Adrian Pirvulescu

Reputation: 4340

You should always listen for errors as well.

Ex:

imgLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onImgLoadError);

Most of the cases the path/url you are using it is not correct.

Upvotes: 5

Related Questions