Cookie question

I’ve setup a simple cookie action based on one of the tutorials available on this site (by the way kirupa rocks). However, I’d like to be able to test for time.

Ideally, the animation should play the first time the person visits the site, but not again for another couple hours.

This is what I have right now:

Frame 1:
user = SharedObject.getLocal(“user_profile”);
matrix_time = user.data.name+6000;
if (user.data.name == undefined||myDate.getTime() >= matrix_time) {
play();
} else {
_root.gotoAndStop(163);
outline.gotoAndStop(121);
title.gotoAndStop(51);
}

Frame 51:

user.data.name = myDate.getTime();
user.flush();

Hi kpkratz

Ideally, the animation should play the first time the person visits the site, but not again for another couple hours.

This depends on the user staying on your site for another couple of hours - are you that is going to happen ?

Perhaps it would be better to play the animation according to the number of times the site had been visited. Maybe !

SteveD

good point – I’ll try that instead…

thanks

this works on loading the animation every 6th load:

user = SharedObject.getLocal(“user_profile”);
if (user.data.name == undefined || user.data.name >= 5) {
user.data.name = 1;
user.flush(“user_profile”);
outline.gotoAndPlay(1);
title.gotoAndPlay(1);
gotoAndPlay(2);
} else {
_root.gotoAndStop(163);
outline.gotoAndStop(121);
title.gotoAndStop(51);
user.data.name = user.data.name + 1;
user.flush(“user_profile”);
}

:bounce: later