Anyonw know how to redirect in flash?

Moto801

Senior Member
Joined
Apr 25, 2009
Messages
1,000
Reaction score
478
I know how to redirect to a url after a flash movie has finished. but what i want to do is set a date to when the redirect starts. like it doesn't start redirecting until a week has past.

If anyone could offer any advice on how to do this it would be appreciated.

Thanks
 
Something like this should work:

Code:
var now:Date = new Date();
var trigger:Date = new Date(2010, 9, 2, 16, 15, 32); //2 October 2010 at 16:15:32

if (now.getTime() >= trigger.getTime())
{
    navigateToURL(new URLRequest("your url here"), "_blank");
}
The second date object is the date you want the redirect to trigger on. Note the second number in the Date() contructor is the month and is 9 instead of 10 as you might expect for October, that's because the months are 0-indexed, meaning January is 0. The date and time is UTC, not the local time of the computer the SWF is running on, so it should trigger at the same time all around the world.

Edit: Obviously if you don't want to open in a new window use _self instead of _blank.
 
Last edited:
Back
Top