现在的位置: 首页 > 综合 > 正文

flex数据类型转换

2013年02月25日 ⁄ 综合 ⁄ 共 585字 ⁄ 字号 评论关闭

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> 
<mx:Script> 
<![CDATA[ 
public function showInput():void 


var myInt:int = parseInt(input.text); 
var myFloat:Number = parseFloat(input.text); 
var myNumber:Number = new Number(input.text); 

// use the toString() method to convert from a number to a string 
mx.controls.Alert.show("Integer: " + myInt.toString() + 
"; Float: " + myFloat.toString() + 
"; Number: " + myNumber.toString()); 


]]> 
</mx:Script> 

<mx:TextInput id="input" x="10" y="10" width="78"/> 
<mx:Button x="96" y="10" label="Show Number" click="showInput();"/> 

抱歉!评论已关闭.