flex学习笔记

《一》

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"  creationComplete="createListener();">
<mx:Panel  title="Currency Converter" width="450" height="150" x="20" y="20" layout="absolute">
<mx:Label text="Price in Dollars" x="25" y="37"/>
<mx:Label x="120" y="65" id="lblResults"/>
<mx:TextInput x="120" y="35" id="txtPrice"/>
<mx:Button id="btnConvert" x="290" y="35"  label="Convert to yen" />
 
</mx:Panel> 
<mx:Script>
 <![CDATA[
 public function createListener():void{
 btnConvert.addEventListener(MouseEvent.CLICK,convertCurrency);
 }
  public function convertCurrency(e:Event):void{
  var rate:Number=120;
  var price:Number=Number(txtPrice.text);
  if(isNaN(price))
  {
   lblResults.text="Please enter a valid price;";
  }
  else
  {price=price*rate;
  lblResults.text="Price in Yen:"+String(price);
  }
  }
 ]]>
</mx:Script>
</mx:Application>
《二》

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 <mx:Panel width="350" height="200" x="10" y="10" title="Rate Customer Service" layout="absolute">
  <mx:ComboBox x="20" y="20" id="cbxRating">
  <mx:dataProvider>
   <mx:Array>
    <mx:String>ab</mx:String>
    <mx:String>cd</mx:String>
    <mx:String>efg</mx:String>
    <mx:Object label="asdf" data="5"/>
    <mx:Object label="qwer" data="6"/>
   </mx:Array>
  </mx:dataProvider>
  </mx:ComboBox>
  <mx:Button label="Send" x="140" y="20"/>
  <mx:Label x="20" y="120" text="{cbxRating.value}"/>
 
 </mx:Panel>
</mx:Application>

《三》

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 <mx:Label x="20" y="60" text="Email"/>
 <mx:TextInput y="60" left="90" right="60"/>
 <mx:Label x="20" y="90" text="Comments"/>
 <mx:TextArea left="90" right="60" top="90" bottom="190"/>
 <mx:Button label="Send" bottom="60" right="150"/>
 
</mx:Application>
《四》

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="feedRequest.send()">
 <mx:Panel x="10" y="10" width="475" height="400" layout="absolute" title="{feedRequest.lastResult.rss.channel.title}">
  <mx:DataGrid x="20" y="20" width="400" id="dgPosts" dataProvider="{feedRequest.lastResult.rss.channel.item}">
   <mx:columns>
    <mx:DataGridColumn headerText="Posts" dataField="title"/>
    <mx:DataGridColumn headerText="Date" dataField="pubDate" width="150"/>
    
   </mx:columns>
  </mx:DataGrid>
  <mx:TextArea x="20" y="175" width="400"  htmlText="{dgPosts.selectedItem.description}"/>
  <mx:LinkButton x="20" y="225" label="Read Full Post" click="navigateToURL(new URLRequest(dgPosts.selectedItem.link));"/>
 </mx:Panel>
 <mx:HTTPService id="feedRequest" url="http://blogs.adobe.com/mchotin/index.xml" useProxy="false"/>
 
</mx:Application>

转载于:https://www.cnblogs.com/sweting/archive/2009/10/29/1592609.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值