Actionscript and Date

Hi,

Let me summarise what I want to happen. There are 3 scenes, ‘general’, ‘may’, ‘june’. The .swf opens the general scene.
Open loading the .swf, the user will be led to a page with a button which they click. When the click the button 4 things can happen:

  • If the date is before 15 May, they will be taken to the same scene called ‘general’ and be told they have visited too early
  • If the date is May 15 - 31 (incl.) they will be taken to a scene called “May” and start on frame 1 if 15th, 2 if 16th and so on… (so frame number = [day] - 14)
  • If the date is June 1 - 24 (incl.) they will be taken to a scene called “May” and be placed on the frame number corresponding the day.
  • If the date is 25 June onwards, they will be kept in the same ‘general’ scene and taken to frame which tells them they are too late

I’ve got the following if statement setup on the button, but it won’t work. Does anybody have any suggestions as to how I should alter my code to make it work? Or if anybody knows a script that will work, I would greatly appreciate it!

on(release){ 
	g = new Date();
	if( (g.getDay() < 15) 	&&	(g.getMonth() <= 5)){gotoAndStop("general", 'early');}
	else if((g.getMonth() >= 6) 	&& 	(g.getDay() > 24)){gotoAndStop("general", 'late');}
	else if(g.getMonth() == 5){gotoAndStop("May", ((g.getDay())-14);}
	else if(g.getMonth() == 6){gotoAndStop("June", g.getDay());}
			}