<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()" viewSourceURL="srcview/index.html">

    <mx:HTTPService 
        id="rssParse" 
        url="php/twitter.php" 
        result="processResult(event)"
        resultFormat="e4x" />
        
    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.rpc.events.ResultEvent;
              
            [Bindable]
            private var _rssResults:ArrayCollection;
            
            // Define and use atom namespace.
            private namespace atom = "http://www.w3.org/2005/Atom";
            use namespace atom;
            
            private function processResult(event:ResultEvent):void
            {
                var xmlList:XMLList = event.result.channel.item as XMLList;
                for each(var item:XML in xmlList){
                    var myDate:String = item.pubDate;
                    myDate = myDate.slice(0,22);
                    _rssResults.addItem({title: item.title, date: myDate});
                }
            }
            
            private function init():void
            {
                _rssResults = new ArrayCollection();
                rssParse.send();
            }
        ]]>
    </mx:Script>
<mx:VBox width="400" height="600" horizontalAlign="center">    
    <mx:Label styleName="subTitleText" text="Twitter Feed:" fontWeight="bold" fontSize="16"/>
    <mx:VBox height="500" width="400" verticalScrollPolicy="auto" horizontalScrollPolicy="off" horizontalAlign="center">
        <mx:Repeater id="twitter" dataProvider="{_rssResults}">
            <mx:Text textAlign="center" width="300" text="{twitter.currentItem.date}"/>
            <mx:Text textAlign="center" width="300" text="{twitter.currentItem.title}"/>
        </mx:Repeater>            
    </mx:VBox>    
</mx:VBox>    
</mx:Application>