Flex TextInput dynamically infer input content
<?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=" "><FX": script><! [Cdata[import spark.events.textoperationevent;[ bindable]private var errorstr:string = "";p rotected 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= "text=" Number: " Textalign= "right"/><s:textinput id= "Numinput" width= "$" change= "Numinput_changehandler (event)" ErrorString = "{errorstr}"/><s:spacer width= "/><s:label id=" Alarmlabel "visible=" false "color=" 0xFF0000 "text=" Simply agree to enter the numbers "," separated "/></s:hgroup></s:application>
Flex TextInput dynamically infer input content