Error Loading XML in AS 3.0

Hello, I’m trying to do the XML in AS 3.0 on this site, but the code doesn’t work properly.

This code gives an error every time.

var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(newURLRequest(“http://www.kirupa.com/net/files/sampleXML.xml”)); function LoadXML(e:Event):void { xmlData = new XML(e.target.data); trace(xmlData);}

I get type was not found or is not a compile time constant pointing to line 9
which is ‘function LoadXML(e:Event):void {’ Can someone explain how to fix
this and why it’s causing an error?

I guess the problem here is when ur casting e.target.data into XML you dont have to use new keyword while doing that.

so just replace " xmlData = new XML(e.target.data); " with " xmlData = XML(e.target.data); "

This should work fine now

[quote=amarghosh;2331549]where is the remaining part that explains what is the type missing?

i guess it says Event.
import it;
ActionScript Code:
[LEFT][COLOR=#0000ff]import[/COLOR] flash.[COLOR=#000080]events[/COLOR].[COLOR=#000080]Event[/COLOR];
[/LEFT]

[/quote]

That appears to have solved it. Thanks. I just copied the code supplied, there were no import statements listed in the tutorial.

Now it’s pointing to the XML instead of Events.

Let’s make this easier. What are the packages I have to import to start and finish the tutorial? Am I missing the reason they weren’t actually included in the code?