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.

  1. In Source mode, enter the following 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.

  2. Save the file, wait until Flex Builder finishes compiling the application, and click the Run button in the toolbar.

    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 application in web browser. Item selected in DataGrid.


Flex 2.01

Take a survey