使用Web服务

 在应用程序中使用数据库,Adobe提供了若干组件,如Web Service,HTTP Service,Remote Object Service这些组件都称为远程调用(RPC)组件。

使用LinkButton打开一个url:

<mx:LinkButton x="30" y="250" label="Select an item and click here for full post"
click="navigateToURL(new URLRequest(dgTopPosts.selectedItem.postLink));" />

Demo:显示weblog网页中点击统计信息,并通过LinkButton打开选中项。

<? xml version = " 1.0 "  encoding = " utf-8 " ?>
< mx:Application xmlns:mx = " http://www.adobe.com/2006/mxml "  layout = " absolute "
    creationComplete
= " wsgBlogAggr.getMostPopularPosts.send() " >
    
< mx:WebService id = " wsgBlogAggr "
         wsdl
= " http://weblogs.macromedia.com/mxna/webservices/mxna2.cfc?wsdl "
         useProxy
= " false " >
        
< mx:operation name = " getMostPopularPosts " >
            
< mx:request >
                
< daysBack > 30 </ daysBack >
                
< limit > {cbxNumberPosts.value} </ limit >
            
</ mx:request >
        
</ mx:operation >
    
</ mx:WebService >


    
< mx:Panel x = " 10 "  y = " 10 "  width = " 475 "  height = " 400 "  layout = " absolute "  title = " Most Popular Posts " >
        
< mx:ComboBox x = " 10 "  y = " 25 "  id = " cbxNumberPosts "
             change
= " wsgBlogAggr.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 x = " 10 "  y = " 67 "  id = " dgTopPosts "  width = " 400 "
            dataProvider
= " {wsgBlogAggr.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 = " 10 "  y = " 231 "  label = " Select an item and click here for full post "
            click
= " navigateToURL(new URLRequest(dgTopPosts.selectedItem.postLink)); " />
    
</ mx:Panel >
    
</ mx:Application >


 

Result:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值