初学Flex 报表程序

看完了Flex中文帮助文档,这是书中第二个包含实际功能的示例,一个可以显示最近30天最热门帖子的程序,数据来源于SOAP-based web service。比起上一个HTTPService的程序,这个要复杂得多。

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="wsBlogAggr.getMostPopularPosts.send();">
	<mx:Script>
		<![CDATA[
			import flash.net.navigateToURL;
		]]>
	</mx:Script>
	<mx:Panel title="Most Popular Posts" layout="absolute" width="475" height="400" x="10" y="10">
		<mx:ComboBox id="cbxNumPosts" x="20" y="40" change="wsBlogAggr.getMostPopularPosts.send();">
			<mx:Object label="Top 5" data="5"/>
			<mx:Object label="Top 10" data="10"/>
			<mx:Object label="Top 15" data="15"/>
		</mx:ComboBox>
		<mx:DataGrid id="dgTopPosts" x="20" y="90" height="180" width="400" dataProvider="{wsBlogAggr.getMostPopularPosts.lastResult}">
			<mx:columns>
				<mx:DataGridColumn headerText="Top Posts" dataField="postTitle"/>
				<mx:DataGridColumn headerText="Clicks" dataField="clicks" width="75"/>
			</mx:columns>
		</mx:DataGrid>
		<mx:LinkButton x="20" y="280" label="Select an item and click here for full post" click="navigateToURL(new URLRequest(dgTopPosts.selectedItem.postLink));"/>
	</mx:Panel>
	<mx:WebService id="wsBlogAggr" wsdl="http://feeds.adobe.com/webservices/mxna2.cfc?wsdl" useProxy="false">
		<mx:operation name="getMostPopularPosts">
			<mx:request>
				<daysBack>30</daysBack>
				<limit>{cbxNumPosts.value}</limit>
			</mx:request>
		</mx:operation>
	</mx:WebService>
</mx:Application>

 

你可能感兴趣的:(Flex)