In the Live docs you might have read about Retrieve and Display Data. Here I’ve enhanced the same MXML by the following
- The LinkButton hidden until the datagrid change event is fired.
- Enabled the Data Tips for ‘Posts’ column to show tool tips text on roll over.
- Made it a scalable layout by using constraint-based layout.
Here is the MXML code, I’ve highlighted the changes by bold, compare it with the original, compile and see for your self
[cc lang=”actionscript3″]
<?xml version=”1.0″ encoding=”UTF-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” creationComplete=”feedRequest.send()” minHeight=”360″ minWidth=”500″>
<mx:HTTPService id=”feedRequest” url=”http://weblogs.macromedia.com/mchotin/index.xml” useProxy=”false”/>
<mx:Panel left=”10″ top=”10″ bottom=”10″ right=”10″ layout=”absolute” title=”BlogReader ({feedRequest.lastResult.rss.channel.title})“>
<mx:DataGrid id=”dgPosts” left=”20″ right=”20″ top=”20″ bottom=”125″ dataProvider=”{feedRequest.lastResult.rss.channel.item}“ change=”openLinkButton.visible=true”>
<mx:columns>
<mx:DataGridColumn headerText=”Posts” dataField=”title“ showDataTips=”true”/>
<mx:DataGridColumn headerText=”Date” dataField=”pubDate”/>
</mx:columns>
</mx:DataGrid>
<mx:TextArea left=”20″ right=”20″ bottom=”46″ height=”75″ htmlText=”{dgPosts.selectedItem.description}”/>
<mx:LinkButton id=”openLinkButton” right=”20″ bottom=”20″ label=”Read Full Post” click=”navigateToURL(new URLRequest(dgPosts.selectedItem.link));“ visible=”false”/>
</mx:Panel>
</mx:Application>
[/cc]