flex學習筆記

來源:互聯網
上載者:User

《一》

<?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>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.