A friend asked for some help with displaying content only on the first visit of a site. This is the example I wrote for him:
// request the flash cookie/local shared object with the name "someCookieId"
var myFlashCookie:SharedObject = SharedObject.getLocal("someCookieId");
// check if the field "isFirstStart" is set
if(myFlashCookie.data["isFirstStart"]==undefined){
// the field "isFirstStart" is not set, set it now
myFlashCookie.data["isFirstStart"]=true;
// write cookie
myFlashCookie.flush();
// jump to a frame with the label "help"
gotoAndStop("help");
}else{
// the flash cookie "isFirstStart" was set, that means we don't need
// to show first time help, go right to the frame with the name "start"
gotoAndStop("start");
}
0 Comments until now.
Comment!