PDA

View Full Version : XML problems


Neobii
11-08-2007, 12:06 AM
I have this code

var currentEventXML:XML;
var currentEventLoader:URLLoader = new URLLoader;
currentEventLoader.load(new URLRequest("data/images.xml"));
currentEventLoader.addEventListener(Event.COMPLETE ,loadFinished);

function loadFinished(event:Event){
currentEventXML = event.target.data;
trace(currentEventXML);
}

and this XML
<images>
<image full="images/full/image1.jpg" thumb="images/thumb/image1.jpg"></image>
<image full="images/full/image2.jpg" thumb="images/thumb/image2.jpg"></image>
<image full="images/full/image3.jpg" thumb="images/thumb/image3.jpg"></image>
<image full="images/full/image4.jpg" thumb="images/thumb/image4.jpg"></image>
</images>

it is giving me an error, TypeError: Error #1034: Type Coercion failed: cannot convert

What am I doing wrong?

Neobii
11-08-2007, 12:21 AM
Okay I figured it out... I had to convert the data to xml.

currentEventXML = XML(event.target.data);