Another Simple Atom Example

I am getting ready to release a beta of an ActionScript class to load, parse and manipulate Atom feeds.

Here is another simple example that I put together, to help test some of the APIs.


Here is the code:

[code]import com.macromedia.data.Atom;var a:Atom = new Atom();a.addEventListener(“onAtomLoad”, this);entryTree.addEventListener(“change”, this);entryField.html = true;titleField.setStyle(“borderStyle”, “none”);titleField.setStyle(“fontSize”, 20);descriptionField.setStyle(“borderStyle”, “none”);var entries:Array;//event broadcast once the Atom feed has been loadedfunction onAtomLoad(eventObj:Object):Void{titleField.text = a.getFeedTitle()[“value”];descriptionField.text = a.getFeedTagline()[“value”];entries = a.entries;var len:Number = entries.length;//build the XML nodes for the Tree componentvar treeXML:String = “”;for(var i:Number = 0; i < len; i++){treeXML += "”;}treeXML += “”;entryTree.dataProvider = treeXML;entryTree.setIsOpen(entryTree.getTreeNodeAt(0), true);entryTree.selectedNode = entryTree.getTreeNodeAt(0).getTreeNodeAt(0);change({target:entryTree, type:”change”});}function change(eventObj:Object):Void{var index:Number = Number(eventObj.target.selectedItem.attributes.index);entryField.text = entries[index].content.value;}a.load(“http://www.markme.com/mesh/atom.xml”);[/code]