# Cookie question

**URL:** <https://forum.kirupa.com/t/cookie-question/18850>\
**Category:** flash\
**Created:** [April 21, 2003, 11:43pm UTC](https://forum.kirupa.com/t/cookie-question/18850 "2003-04-21T23:43:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kpkratz](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@kpkratz](https://forum.kirupa.com/u/kpkratz)\
**Post date:** [April 21, 2003, 11:43pm UTC](https://forum.kirupa.com/t/cookie-question/18850/1 "2003-04-21T23:43:19Z")

</div>

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();

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 22, 2003, 8:38am UTC](https://forum.kirupa.com/t/cookie-question/18850/2 "2003-04-22T08:38:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 22, 2003, 6:03pm UTC](https://forum.kirupa.com/t/cookie-question/18850/3 "2003-04-22T18:03:11Z")

</div>

good point – I’ll try that instead…

thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 22, 2003, 6:35pm UTC](https://forum.kirupa.com/t/cookie-question/18850/4 "2003-04-22T18:35:02Z")

</div>

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
