A quick way to do it I can think of off the top of my head is making a copy
of the user's input, strip the thousands separator, cast to Number and pass
the result to some formatNumber function (like the one in the ActionScript
CookBook lib). Then, just compare that with the original input;  if they're
equal, the input should be ok.

Cheers
Juan Pablo Califano


2008/7/16, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> Hello Everybody,
>
> Before I try to maybe "re-invent the Wheel", and write my own code.  I  was
> wondering whether anyone has a sample Actionscript 3.0 code for
> verifying  the
> input to a text field is a Number.
>
> Generally, the isNaN() is ok.  But when one input a number with  the
> "Thousand Separator" (Comma) or ((Period) in certain countries)),
> isNaN()  does not
> work.
>
> For example, suppose the required answer (input) is 10000.00.  If the  user
> inputs 10,000.00.  Flash does not consider that as a number. If  the user
> inputs 100,00.00 that is certainly not a number.
>
> So, unless I am missing some built-in Actionscript fuction/class, the code
> needs to check whether the input contains Thousand separator(s)
> and  whether
> they are in the right position.
>
> Once the check on the Thousand Separator(s) proves to be OK, i.e.,
> the  input
> is a legal number, we can than compare this number to the one  required.
>
>
> Thank you,
> D. Abramovich
>
>
> Interactive Training Solutions  (ITS)
> _www.its-metacentre.com_ (http://www.its-metacentre.com)
>
>
>
> **************Get the scoop on last night's hottest shows and the live
> music
> scene in your area - Check out TourTracker.com!
> (http://www.tourtracker.com?NCID=aolmus00050000000112)
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to