topical media & game development

talk show tell print

actionscript-book-RSSViewer-RSSViewer.mx

actionscript-book-RSSViewer-RSSViewer.mx [swf] [flash] flex


  <mx:Application 
          xmlns:mx="http://www.adobe.com/2006/mxml" 
          xmlns="*" 
          layout="vertical"
          paddingTop="0"
      horizontalAlign="center"
          creationComplete="initApp()" >
                  <mx:Script>
                          <![CDATA[
                                  //import com.example.programmingas3.rssViewer.RSSParser; 
                                  
                                  
Instantiate an RSSParser object. RSSParser includes methods for converting RSS XML data into HTML text.

   
                                  public var rssParser:actionscript_book_RSSViewer_com_example_programmingas3_rssViewer_RSSParser;
                                  
                                  
Sets the title text, description, and output HTML from an RSS feed.

  
                                  public function initApp():void {
                                          rssParser = new actionscript_book_RSSViewer_com_example_programmingas3_rssViewer_RSSParser();
                                          rssParser.addEventListener("dataWritten", onDataReceived)
                                  }
                                  
                                  
Called when the rssParser object has completed loading of the RSS data.

  
                                  public function onDataReceived(e:Event):void {
                                          rssTitle.text = "Feed: " + rssParser.rssTitle;
                                          rssText.htmlText = rssParser.rssOutput;
                                  }
                          ]]>
                  </mx:Script>
                  
                  <mx:Label id="title" text="RSS Viewer Example" fontSize="24" fontStyle="bold"/>
          <mx:Label id="subtitle" text="From Programming ActionScript 3.0, Chapter 10: Working with XML" fontSize="12" />        
  
                  <mx:Label id="rssTitle" fontSize="18" />
                          
                  <mx:TextArea id="rssText" width="600" height="100%" />                
                          
  </mx:Application>


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.