Pages

Friday, February 11, 2011

AS3: Minimum code required to load XML at run-time

Minimum code required to load XML at run-time is given below:

SOURCE CODE
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener (Event.COMPLETE, onEventComplete);
urlLoader.load (new URLRequest('Database.xml'));

function onEventComplete (e:Event):void
{
  var Xml:XML = new XML(URLLoader(e.target).data);
  trace (Xml);
}


No comments:

Post a Comment