Restrict text input to numbers only

Hi all,

I have a quick question.

In as3, Flash CS6 I am using :

However, the textfield accepts a “.” too (dot/decimal point).
It does not accept comma ","
Any idea why ?

I also tried

Then the field also accepts a “.”

The textfield should only accept numbers and no punctuation.

Thanks in advance !

Hmm, i would think it shouldnt take a period. Maybe it was an oversight by the flash team?

Anyway post #5 here. By thecodebot looks like it may solve your problem for now

Thanks for the tip.

For now I solved it this way:

[code]txtStartlocation.addEventListener(KeyboardEvent.KEY_DOWN, fncCheckPoint);

function fncCheckPoint(e:KeyboardEvent):void{
var strInput:String = txtStartlocation.text;
strInput = strInput.split(".").join("");
txtStartlocation.text = strInput;
}
[/code]

I like it, its more streamlined that the link i gave.