Posts Tagged ‘rss’

There are quite a lot of Flex RSS feed examples out there already, but the format I’m using for my examples here would have made things easier for me to grasp earlier on, so I offer this example in case anyone else out there might likewise have an easier time with this format. This example reads in and displays the RSS feed from my WordPress-based Flex blog here. Any WordPress blog could easily be replaced in this example by changing the address of the httpRSS url and any xml-based RSS feed could be as easily parsed so long as the feed’s tags are set properly.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
	creationComplete="httpRSS.send()" viewSourceURL="srcview/index.html">
 
	<mx:HTTPService id="httpRSS" url="http://www.dmallonee.com/flex/rss/"/>
	<mx:Panel layout="absolute" left="10" top="10" bottom="10" right="10" title="RSS Example">
		<mx:VBox width="100%" horizontalAlign="left" creationCompleteEffect="Fade"
			paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
			<mx:Repeater width="100%" id="rssItems"
				dataProvider="{httpRSS.lastResult.rss.channel.item}">
					<mx:Label text="{rssItems.currentItem.title}" fontWeight="bold"
						paddingLeft="6" paddingRight="6"/>
					<mx:LinkButton width="100%" textAlign="left"
						label="{rssItems.currentItem.link}"
						fontWeight="normal" textDecoration="underline"
						click="navigateToURL(new URLRequest(event.currentTarget.label.toString()))"/>
					<mx:TextArea editable="false" paddingLeft="6" paddingRight="6"
						width="100%" height="50" borderStyle="none"
						htmlText="{rssItems.currentItem.description}"/>
			</mx:Repeater>
		</mx:VBox>
	</mx:Panel>
 
</mx:Application>

Example: dm_simple_rss.swf
Flex Project: dm_simple_rss.zip