# Need help with age verification page

**URL:** <https://forum.kirupa.com/t/need-help-with-age-verification-page/270190>\
**Category:** Uncategorized\
**Created:** [September 6, 2008, 4:25am UTC](https://forum.kirupa.com/t/need-help-with-age-verification-page/270190 "2008-09-06T04:25:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaZ8Teen](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kaZ8Teen](https://forum.kirupa.com/u/kaZ8Teen)\
**Post date:** [September 6, 2008, 4:25am UTC](https://forum.kirupa.com/t/need-help-with-age-verification-page/270190/1 "2008-09-06T04:25:41Z")

</div>

So I followed this tutorial to create an age verification page but I don’t really have the AS knowledge to finish it up.

Problems:

I don’t know how to link the text to the appropriate website when they are verified. EX: “You may enter” linking to the site. “You are not of age” linking to [disney.com](http://disney.com) or something.

Also, when there are no digits entered, it verifies the user of age.

[Age Verification page](http://www.kaz-designs.info/age.swf)

Actionscript below.

package  
{

```
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.FocusEvent;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.display.SimpleButton;
import flash.net.SharedObject;

public class AgeCheck extends MovieClip
{

	var hostName:String = "WDAgeChk"
	var MINAGE:int	= 20;
	public function AgeCheck()
	{
		init();
	}
	
	private function init():void
	{
		// Check SharedLocalData
		sharedData();
		
		year_txt.addEventListener(FocusEvent.FOCUS_OUT, onYearOut);
		year_txt.addEventListener(FocusEvent.FOCUS_IN, onYearin);
		day_txt.addEventListener(FocusEvent.FOCUS_IN, onDayin);
		month_txt.addEventListener(FocusEvent.FOCUS_IN, onMonthin);
	}
	private function onYearOut(evt:FocusEvent):void	
	{
			checkDate();
	}
	
	private function onYearin(evt:FocusEvent):void	
	{
			year_txt.text = "";
	}
	
	private function onDayin(evt:FocusEvent):void	
	{
			day_txt.text = "";
	}
	private function onDayOut(evt:FocusEvent):void	
	{
			day_txt.text = "";
	}
	
	private function onMonthin(evt:FocusEvent):void	
	{
			month_txt.text = "";
	}
	
	private function sharedData():void
	{
		var mySo:SharedObject = SharedObject.getLocal(hostName);
        var myAge:String = mySo.data.age;

		if(Number(myAge) &lt; MINAGE){
			yourAge_txt.text = "You are not of age.";
			// load error page here.
		} else {
			// enter the web site.
		}
			
	}
	private function checkDate():void
	{
		var chk: Date= new Date(year_txt.text, month_txt.text,day_txt.text);
		var today: Date = new Date();
		var years:Number = today.getFullYear() - chk.getFullYear();  
		if (years &gt; 20){
			yourAge_txt.text = "You may enter.";
			//yourAge_txt.addEventListener(MouseEvent.CLICK, onEnter);

		} else {
			yourAge_txt.text = "You are not of age.";
			var mySo:SharedObject = SharedObject.getLocal(hostName);
        	mySo.data.age = years;
       		var flushResult:Object = mySo.flush();
		
		}
	}
	
}

```

}

Thanks, Kaz
