• flickr
  • linkedin
  • twitter
  • rss
Loading XML into flash as an XML object

Loading XML into flash as an XML object

loading XML into flash as an XML object

// xml loader
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, loadXML);
xmlLoader.load(new URLRequest("leadership_development_framework.xml"));
function loadXML(event:Event):void
  xmlData = new XML(event.target.data);

Further to that, once you’ve your xmlData filled, you can chop it up with XMLList to make sub-listings for easier management.

For example, say I have an xml formatted like so:

      <title>Item 1</title>
      <title>Item 2</title>

To make an XML list of just the content within the first item, I could make an subset of data with XMLlist – ie.

var titleList:XMLList = xmlData.main.item[0].*;

Great tutorial on Kirupa about it which is much more instructional, this is more of a mental primer for myself:

Tech Reference:

Larry's a 30-something chap interested in travel, being a dork and changing the world via less boring training.

Leave a reply