<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ public function convertCurrency():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:Panel x="10" y="10" width="410" height="200" layout="absolute"> <mx:Label x="10" y="10" text="请输入美元" width="76"/> <mx:Text y="10" id="txtPrice" height="20" text="10" enabled="true" width="149" x="81"/> <mx:Button x="252" y="8" id="cmdConvert" label="转换" click="convertCurrency()"/> <mx:Label x="10" y="59" id="lblResults" width="228" text="轮换后"/> </mx:Panel> </mx:Application>