Sunday, February 11, 2007

Flex2: Populate ComboBox from RSS

Starting out in Flex development, one of the "simplest" things I wanted to do is to populate a ComboBox with values from an RSS feed (XML). Surprisingly enough, despite all the Flex documentation available, i had a hard time finding exactly how to do it.

So here it is for those who may be looking for something similar:

<mx:HTTPService id="feedRequest"
url="http://www.megaszu.com/photoblog/rss.asp"
useProxy="false" />

<mx:ComboBox
dataProvider="{feedRequest.lastResult.rss.channel.item}"
labelField="title" />

Note that the key is specifying the "labelField" property for the combobox. The below will not work:
<mx:ComboBox
dataProvider="{feedRequest.lastResult.rss.channel.item.title}" />
Take a look at the actual feed to see its structure.


Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home