View Full Version : shard objects
Xpeder
June 11th, 2003, 01:17 AM
I know there is a tut on shard objects but i was wondering if there is a way to like have a score and then have it save so every time you come back it is the same and keeps going up. for example there is a button and you click it and it says one then you refresh the browser and then it still says one so over time it will be like over 1,000:chinaman:
Clown Staples
June 11th, 2003, 01:51 AM
thats pretty well covered in the tutorial
Xpeder
June 12th, 2003, 12:03 AM
i am not to good with actionscripts so can you kinda break it down for me? thanx
Clown Staples
June 13th, 2003, 05:16 PM
function onLoad(){
mySO=SharedObject.getLocal("hitcounter");
if(mySO.data.hits==null)
mySO.data.hits=0;
mySO.data.hits++;
mySO.flush();
_root.hitcount=mySO.data.hits;
}
Clown Staples
June 13th, 2003, 05:19 PM
translation (line by line)
when the movie loads
create or find a previous cookie called "hitcounter"
if the hits variable has never been set
set it to zero
then add one to it (whether it is new or not)
update the cookie file
set the _root.hitcount variable to be the current hitcount from the cookie (now just make a text field that has _root.hitcount as its variable)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.