| Getting Started with Flex 2 > Lessons > Retrieve and Display Data > Display a selected item | |||
When the user selects a post in the DataGrid control, you want the application to display the first few lines of the post in the TextArea control. In the item node of the XML feed, this information is contained in a field called description.
htmlText property (in bold) in the <mx:TextArea> tag:
<mx:TextArea x="20" y="175" width="400"
htmlText="{dgPosts.selectedItem.description}" />
For each selected item in the DataGrid component (named dgPosts), the value of the description field is used for the value of the htmlText property. The htmlText property lets you display HTML formatted text.
A browser opens and runs the application. Click items in the DataGrid control. The first few lines of each post should appear in the TextArea control.
Flex 2.01