Note that there are some explanatory texts on larger screens.

plurals
  1. POFlash sharedobject flush help
    primarykey
    data
    text
    <p>On my site I have a flash banner that saves its frame position when the user changes pages so that it continues to play rather than restart every time a user navigates around the site. This was implemented using sharedobject. It works great except for one thing: the cookie lasts too long. Even when I come back to the site later on in the day it still reloads my last position. I want to flush the sharedobject when the user navigates away from the domain name but I'm unsure how to implement it. Could someone help please! </p> <p>Ok thanks for your response Lars. Here's what I got:</p> <pre><code>var mySharedObject:SharedObject = SharedObject.getLocal("displayCookie"); var expiredate = mySharedObject.data.expires; var timeobject = new Date(); var timestamp = timeobject.getTime(); if (expiredate&lt;=timestamp &amp;&amp; expiredate != null) { for (var i in mySharedObject.data) { delete mySharedObject.data[i]; } mySharedObject.flush(); } else if (expiredate == null) { var oneday = 100; var expiresIn = 1; var expiretimestamp = timestamp+expiresIn*oneday; mySharedObject.data.expires = expiretimestamp; mySharedObject.flush(); } if (mySharedObject.data.introcheck != 0) { mySharedObject.data.introcheck = 0; mySharedObject.flush(); gotoAndPlay(1); } else { addEventListener(Event.ENTER_FRAME, checkLoadedFrames); function checkLoadedFrames(e:Event):void { if(this.framesLoaded == this.totalFrames) { removeEventListener(Event.ENTER_FRAME, checkLoadedFrames); checkSharedObject(); } } function checkSharedObject():void { if(mySharedObject.data.currentFrame){ gotoAndPlay(mySharedObject.data.currentFrame); } addEventListener(Event.ENTER_FRAME, saveCurrentFrame); } function saveCurrentFrame(e:Event):void { mySharedObject.data.currentFrame = this.currentFrame; } } </code></pre> <p>I changed the oneday var to 100ms to check if it works but it doesn't. What am I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload