AS3 - SharedObjects - clear when browser is closed

Hi everyone,

I’ve been truying to figure out the best way of tracking web sessions in flash.
the main problem is having a flash animated that has two animations, one for the entry and one that loops.

What I need is the user to see the “entry” animation when the browser first opens to that page, and then I play the loop animation throught a timer event every couple seconds. Now what is happening is the entry keeps playing on every refresh, or when the user visists another link on that same website.

To work around that, we set up a cookie in JavaScript that tracks the session and tells flash which animation to play, after the browser is closed that cookie is cleared, worked perfect except in IE.

I have no experience in JavaScript and wanted to work around this problem using flash to set a cookie wiht SharedObjects.

when the swf is loaded I set a variable to true rioght after the entry animation plays, so if the user is still on the page, the swf checks the cookie and if it finds “true” then it plays the loop animation.

better drawn below:

  1. browser is launched

  2. cookie created value = false (default)

  3. swf checks the cookie finds false --> plays Entry animation

  4. end of Animation, in the cookie value is set to true

  5. swf checks the cookie finds true —> plays Loop animation

  6. anyway to clear that cookie or set it back to false, right before the browser is closed

all this is to track the session pretty much.

is there any work around? I couldn’t find anything anywhere :S

Please help