PDA

View Full Version : Unhandled error event



tabatsoy
May 10th, 2009, 11:53 PM
Greetings Earthlings!!!

I'm getting and error: Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

Here is my code:



var image_loader:Loader;
var xml:XML;
var xml_list:XMLList;
var xml_loader:URLLoader = new URLLoader();

xml_loader.load(new URLRequest("images.xml"));

xml_loader.addEventListener(Event.COMPLETE, xml_loaded);

function xml_loaded(event:Event):void {
xml = XML(event.target.data);
xml_list = xml.children();

trace(xml);

image_loader = new Loader();
image_loader.load(new URLRequest(xml_list.attribute("source")));

addChild(image_loader);
}
and here is my folder structure: New Folder \ [images(folder)] [images.xml] [untitled1.fla] [untitled1.swf] \ [image1.jpg] [image2.jpg] [image3.jpg] [image4.jpg] [image5.jpg]

and here is my xml :


<?xml version="1.0" encoding="utf-8"?>
<images>
<image source="images/image1.jpg">image 1</image>
<image source="images/image2.jpg">image 2</image>
<image source="images/image3.jpg">image 3</image>
<image source="images/image4.jpg">image 4</image>
<image source="images/image5.jpg">image 5</image>
</images>
thanks and I hope to hear from you soon
:yoda:

kunjan
May 19th, 2009, 09:05 AM
Hello

you are not allow directly xml_list.attribute("source") you have to use index number with this like xml_list[0].attribute("source")

I am attaching whole code here and make sure that the folder which contain fla is also contains folder "images" and images folder also contain file which are specify in xml with same name & extension

code start=====================================

var image_loader:Loader;
var xml:XML;
var xml_list:XMLList;
var xml_loader:URLLoader = new URLLoader();

xml_loader.load(new URLRequest("images.xml"));

xml_loader.addEventListener(Event.COMPLETE, xml_loaded);

function xml_loaded(event:Event):void {
xml = XML(event.target.data);
xml_list = xml.children();

image_loader = new Loader();
image_loader.load(new URLRequest(xml_list[0].attribute("source")));

addChild(image_loader);
}

code end ========================================

let me know if you have any query...

Regards,
Kunjan.