A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Expire local shared object?

  1. #1
    Senior Member
    Join Date
    Oct 2002
    Posts
    273

    Expire local shared object?

    Is there any way to set an expiration time for a local shared object as you can with a cookie?

    Thanks.

  2. #2
    ActionScript Insomniac
    Join Date
    Jan 2003
    Location
    43d03.21'N, 89d23.65'W
    Posts
    1,173
    You could do:
    code:

    var d;
    var mySO = SharedObject.getLocal("expTest", "/");
    if ( !mySO.data.expirationDate) {
    var daysTillExpiration = 5;
    d = new Date();
    d.setDate(d.getDate() + daysTillExpiration);
    mySO.data.expirationDate = d;
    }

    d = new Date();
    trace("current : " + d);
    trace("expires : " + mySO.data.expirationDate);
    if (mySO.data.expirationDate < d) {
    trace( "expired" );
    } else {
    trace( "still valid");
    }


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center