Flex TextInput 動態判斷輸入內容,flextextinput

來源:互聯網
上載者:User

Flex TextInput 動態判斷輸入內容,flextextinput

 

Flex TextInput 動態判斷輸入內容

 

<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"    xmlns:s="library://ns.adobe.com/flex/spark"    xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"><fx:Script><![CDATA[import spark.events.TextOperationEvent;[Bindable]private var errorStr:String = "";protected function numInput_changeHandler(event:TextOperationEvent):void{var exp:RegExp= /[\d,,]/g;var inputText:String = numInput.text+'';if(inputText==''){return;}if(inputText.match(/[,,]$/)){inputText = inputText.substring(0,inputText.length-1);}var temp:String = inputText.replace(exp,'');var isRight:Boolean = true;if(temp==''){var arr:Array = inputText.split(/[,,]/);for(var i:int =0;i<arr.length;i++){var oneNum:String = arr[i];if(oneNum==null || (oneNum+'')== ''){isRight = false;}}}else{isRight = false;}if(isRight){numInput.setStyle('borderColor','black');alarmLabel.visible = false;}else{numInput.setStyle('borderColor','0xFF0000');alarmLabel.visible = true;}}]]></fx:Script><fx:Declarations></fx:Declarations><s:HGroup width="100%" height="30" horizontalAlign="left" paddingLeft="5"  paddingRight="5" verticalAlign="middle"><s:Label width="60" text="號碼:" textAlign="right"/><s:TextInput id="numInput" width="200" change="numInput_changeHandler(event)" errorString="{errorStr}"/><s:Spacer width="16"/><s:Label id="alarmLabel" visible="false" color="0xFF0000" text="只允許輸入數字以“,”隔開"/></s:HGroup></s:Application>


 


flex 出現 TextInput不可以輸入內容即不可選 ,連擊滑鼠就走不動了,為啥??

連代碼也不給,誰知道你錯在哪了呢?
 
flex textinput 只可以輸入0到100的整數數字 其他輸入不進去

繼承這個class檔案,修改響應的屬性呀
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.