Monday, 15 June 2015

actionscript 3 - In as3 is there a way to check Textinput isnt number? -



actionscript 3 - In as3 is there a way to check Textinput isnt number? -

i need check if text input contains isnt int(number), wondering if possible.

if (!isnan(s1.range))) { s1.tet.text = "please come in fields contains number";

if need check text (string) contain non digits, utilize regexp. easier test string against regular expression.

here's simple illustration check not digit

var str:string = "04.sdf.."; var re:regexp = /[\d]/g; trace(str.match(re).length); // 6

in illustration there 6 char's not digits, therefor can show error user.

here's tutorial on regexp if believe can helpful you:

http://coursesweb.net/actionscript/regexp-regular-expressions-actionscript

actionscript-3 actionscript

No comments:

Post a Comment