Flex4中使用HTTPService与后台交互绑定到DataGrid控件

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx"
			   creationComplete="feedRequest.send();">
	
	<!--Flex中,HTTPService需要定义在<fx:Declarations>中-->
	<fx:Declarations>
		<mx:HTTPService 
			id="feedRequest" 
			url="http://weblogs.macromedia.com/mchotin/index.xml" 
			useProxy="false" />
	</fx:Declarations>
	
	<!--将下载的文件与DataGrid绑定-->
	<mx:Panel title="HTTPService Example" height="75%" width="75%" 
			  paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
		
		<mx:DataGrid id="dgPosts" height="50%" width="75%" 
					 dataProvider="{feedRequest.lastResult.rss.channel.item}">
			<mx:columns>
				<mx:DataGridColumn headerText="Posts" dataField="title"/>
				<mx:DataGridColumn headerText="Date" dataField="pubDate"/>
			</mx:columns>
		</mx:DataGrid>
		
		<mx:TextArea height="50%" width="75%" htmlText="{dgPosts.selectedItem.description}"/>
	</mx:Panel>    
</s:Application>

你可能感兴趣的:(Date,datagrid,Flex,application,library,encoding)