Adam Tworz’s Blog

May 25, 2009

How to load XML with AS3

Filed under: Actionscript 3 Migration — Tags: , , — admin @ 9:33 am

Actionscript 3 handles xmls very well, there’s no need any longer to use special classes as for instance XMLSA which we all used for AS2. Here what we need to do:

import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;
 
var ld = new URLLoader();
ld.addEventListener(Event.COMPLETE,xml_loaded);
ld.load(new URLRequest("menu.xml"));
function xml_loaded(e) {
   xml = new XML(e.currentTarget.data);
   trace(xml);
}

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress