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]

5 Responses to Another Simple Atom Example

  1. zzun says:

    The Atom classes was very interesting.It is very useful!So, I made atom feed reader with it for testing.See http://pluszone.net/archives/2004/02/10-AM0008.html

  2. mike says:

    What happens to the text formatting if you embed an image in the HTML? In my experience this screws up the layout.

  3. mike chambers says:

    zzun,Cool example!mike chambersmesh@macromedia.com

  4. Kam says:

    Hi, can you please help, I have seen your tree component at work above, as you know you have to click the grey arrow in order to view the other articles within that folder.Is there any way i can make the folder open by clicking anywhere on that row(meaning not just the grey arrow but also the folder and label of that folder)I have searched everywhere for an answer to this and just need to know if it is even possible.

  5. Tom D says:

    opens a branch when clicked – you lose the scroll effect…var treeListener:Object = new Object();treeListener.change = function(evt:Object) {if (evt.target.getIsBranch(evt.target.selectedNode)){if (evt.target.getIsOpen(evt.target.selectedNode)){evt.target.setIsOpen(evt.target.selectedNode,false);}else{evt.target.setIsOpen(evt.target.selectedNode,true);}}};trNodes.addEventListener(“change”, treeListener);