I am writing an age verification work sheet for a flash project. Right now, I know that if the user is born before a certain year, then it can allow them to reach the SDF, if they will not refuse. The problem is that if they leave the field empty, it will allow them to be accessed (I'm assuming because the blank field is acceptable as parseInt to validate it) So how am I curious how to To be blocked so that no person will enter the year, it will refuse to reach the SDF. Here's my code for
agetext._viewable = false; Verify_btn.onRelease = function () {if (parseInt (year.text) & lt; = 1992) {_root.age._visible = false; }
and (agetext._visible = true;};
if ParseInt can not parse a valid number, then return
NaN (not a number). You can test it by using
isNaN :
// Investigation of that year is not acceptable & lt; = 1992 var birthyear = parseInt (year.text); Alternatively, you can ensure that TextField is not empty:
if (years! Hole! = Null & amp; year.Text! = "" & Amp; amp; amp; parseInt (year text) & lt; = 1992) {
Comments
Post a Comment