Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
mitsubishi #1
Determining if a var is a number
This probably is a simple problem but I have been struggling with it for some
time. I am trying to determine if a user supplied variable is a number. The
user inputs a value (their age) in an input text box. This means the value is
of type 'String". Using various functions, such as typeof, parseInt and the
Number object I can get a return of NaN if the value is not a number. However I
simply cannot use the return in an if statement eg if (age == NaN) of if(age ==
'NaN') just simply does not evaluate.
Any suggestions?
mitsubishi Guest
-
int Number to text Number Function / UDF ?
Is there a function that converts e.g. 3 to Three? Probably not but I just thought I'd ask. -
determining roles
Hi all, I'm creating a web application that attempts to restrict access by checking the IsInRole function for the desired roles. This works for... -
Determining OS in director
Does anyone know how to determine whether os is Mac OSX + or below or windows? -
sort from the smallest number to the highest number
Hi Just say I want to sort the row by using the fifth column data as reference from the smallest the largest number, if using sort, It will give... -
Determining Coverage
A co-worker was finally able to dig it up in some notes from a class. The equation is 255 - (histogram mean value) / 255 = % coverage. Hopefully... -
James Fee #2
Re: Determining if a var is a number
Look up how to use isNaN().
Jim
"mitsubishi" <webforumsuser@macromedia.com> wrote in message
news:c284tb$f3d$1@forums.macromedia.com...some> This probably is a simple problem but I have been struggling with it forThe> time. I am trying to determine if a user supplied variable is a number.is> user inputs a value (their age) in an input text box. This means the valuethe> of type 'String". Using various functions, such as typeof, parseInt andHowever I> Number object I can get a return of NaN if the value is not a number.if(age ==> simply cannot use the return in an if statement eg if (age == NaN) of> 'NaN') just simply does not evaluate.
>
> Any suggestions?
>
James Fee Guest
-
tralfaz #3
Re: Determining if a var is a number
"mitsubishi" <webforumsuser@macromedia.com> wrote in message
news:c284tb$f3d$1@forums.macromedia.com...some> This probably is a simple problem but I have been struggling with it forThe> time. I am trying to determine if a user supplied variable is a number.is> user inputs a value (their age) in an input text box. This means the valuethe> of type 'String". Using various functions, such as typeof, parseInt andHowever I> Number object I can get a return of NaN if the value is not a number.if(age ==> simply cannot use the return in an if statement eg if (age == NaN) ofYou can restrict the input to numbers only...> 'NaN') just simply does not evaluate.
>
> Any suggestions?
>
Example: input text box named agebox:
agebox.restrict = "0-9";
Here is restriction for alpha letters only...
agebox.restrict = "a-z A-Z";
Here is restriction for letters and numbers only without punctuation etc..
agebox.restrict = "a-z A-Z 0-9";
If the number of chars input is 0, don't evaluate it.
hth
tralfaz
tralfaz Guest
-
tralfaz #4
Re: Determining if a var is a number
BTW.. If you prefer not to use actionscript, you can also restrict the input
text box to numerals only by selecting properties for the input text box:
Properties..
Character button...
Check mark ONLY..
Check mark Numerals (0-9)
tralfaz
> You can restrict the input to numbers only...
> Example: input text box named agebox:
> agebox.restrict = "0-9";
>
> Here is restriction for alpha letters only...
> agebox.restrict = "a-z A-Z";
>
> Here is restriction for letters and numbers only without punctuation etc..
> agebox.restrict = "a-z A-Z 0-9";
>
> If the number of chars input is 0, don't evaluate it.
> hth
> tralfaz
tralfaz Guest



Reply With Quote

