A common question on the Flash boards I hang out on is how to deal with return visitors to your Flash site. After all, the goal is usually to have folks come back to your site and come back often. But how do you keep your content from being a barrier? How often should your visitors have to watch that site intro movie (as brilliant as it is!)? The answer is probably once.Even with the ubiquitous “Skip Intro” button, many visitors will be turned off having to deal with the same intro movie every time they visit a site. Why make them have to click-to-skip when, with a little forethought, you can take care of this and make your site look that much smarter?The answer is in the Shared Object. Shared Objects are basically Flash cookies, a small text file dropped onto your visitor’s computer which you can then reference later. By putting the following code in the first frame of your movie, you’ll initialize a new Shared Object, check to see if that object exists on the current computer and act accordingly (play the intro animation if the user is new, skip it if they’ve been to the site before):
//initialize the shared object – get it if it exists on this computerActually, it doesn't really matter what value you give to “newVisitor” here. For our purposes, we're just checking to see that the object exists. You can get a lot more complex by setting the attribute to different values and acting according to that value.
var my_so:SharedObject = SharedObject.getLocal("visited", "/");
//check to see if the visited info object exists and act accordingly
if (my_so.data.newVisitor != undefined) {
//object exists: return user
//replace "frame-for-return-user" with the frame number that skips your intro animation
this.gotoAndPlay(frame-for-return-user);
} else {
//object doesn't exist: new user
//set the newVisitor attribite of the my_so.data object to indicate this is not a new visitor next time they come to the site
my_so.data.newVisitor = "no";
this.play();
}
You could even add attributes and customize your movie! Have your visitors put their name into an input text field and save it as part of the Shared Object; the next time they visit, customize the greeting by writing the value back to a text field, “Welcome back, Bob!”
The Shared Object has some limitations (a default of a 100k file size limit without the user’s input), but they can be really useful in making your visitors’ experience a lot more personal. Make ‘em feel at home! And keep ‘em coming back!







1. Sorry but i have problems implementing your script.
I have a banner for a website and i want to show 1 part of the movie only once (intro). after this has been shown every time the person goes to another part of the page and the shared object is not null the other part is only seen.
// actionscript
on the first frame it determens wether it should go to intro or de rest,
var my_so:SharedObject = SharedObject.getLocal("visited", "/");
if (my_so.data.newVisitor == "no intro") {
gotoAndPlay("rest");
} else {
gotoAndPlay("intro");
}
on the rest lable i changed the my_so.data.newvisitor to..
my_so.data.newVisitor = "no intro";
my_so.flush();
inb theorie the shared object should always go to the if instead of the else part.. :S
or is this because every tme the page is refreshed (new link changes the entire page)
hopefully you can help me or tell me its impossible
greeting
Vincent
Posted at 2:36PM on Dec 7th 2005 by Vincent