# Script help

**URL:** <https://forum.kirupa.com/t/script-help/170941>\
**Category:** Uncategorized\
**Created:** [November 30, 2005, 5:53pm UTC](https://forum.kirupa.com/t/script-help/170941 "2005-11-30T17:53:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keith30](https://avatars.discourse-cdn.com/v4/letter/k/7ea924/32.png) [@Keith30](https://forum.kirupa.com/u/Keith30)\
**Post date:** [November 30, 2005, 5:53pm UTC](https://forum.kirupa.com/t/script-help/170941/1 "2005-11-30T17:53:43Z")

</div>

This script only works good on a PC.  
I need it to Work on a Mac.  
Can anyone tell me what the problem is?

//place in frame 1 layer 1  
//init variables//  
//60 second lifespan  
var lifespan = 3600;  
var cookiename = “trialperiod”;  
//end init variables//  
function isExpired() {  
var so = SharedObject.getLocal(cookiename);  
var now\_date = new Date();  
//current date in seconds from midnight January 1, 1970  
var now = Math.floor(now\_date.getTime()/1000);  
//if it hasn’t been set yet, declare it  
if (so.data.dateFirstAccessed == undefined) {  
trace(“created “+cookiename+”.sol”);  
so.data.dateFirstAccessed = now;  
so.data.dateLastAccessed = now;  
so.data.expired = false;  
}  
//if the date has been set back  
if (now\<so.data.dateLastAccessed || now\<so.data.dateFirstAccessed) {  
//trace(“now\<so.data.dateLastAccessed”);  
so.data.expired = true;  
}  
//if it has expired naturally  
if (so.data.dateFirstAccessed+lifespan\<now) {  
//trace(“so.data.dateFirstAccessed+lifespan\<now”);  
so.data.expired = true;  
}  
//trace(so.data.dateFirstAccessed);  
//trace(now);  
//trace(so.data.dateLastAccessed-so.data.dateFirstAccessed);  
if (!so.data.expired) {  
so.data.dateLastAccessed = now;  
return false;  
} else {  
return true;  
}  
}  
//check for expiration  
function checkExpiration() {  
if (isExpired()) {  
//clear the checkInterval loop  
clearInterval(\_root.checkInterval);  
//just to make sure that the expired function isnt called more than once  
if (!\_global.expired) {  
expired();  
}  
\_global.expired = true;  
} else {  
//the cookie is still active  
trace(“still good”);  
}  
}  
//expiration function  
function expired() {  
//what to do when the cookie expires  
trace(“expired”);  
gotoAndStop(“expired”);  
}

* * *

//place on frame 1 layer 2  
if (isExpired()) {  
gotoAndStop(“expired”);  
} else {  
gotoAndStop(“trialperiod”);  
}
