;

PDA

Click to See Complete Forum and Search --> : [RESOLVED] sharedObject woes....


EvolveDesigns
07-05-2006, 06:28 PM
I've set these up before no problems.. for some reason this one just won't work. Basically I want it to send my navigations clips to specific frames when the page is reloaded depending on what link was clicked. Everything seems to work except the shared object isn't being saved.. here's my code:


var cookie:SharedObject = SharedObject.getLocal("jrs" );


///send header to biography link upon first visit
if(cookie.data.pageID == undefined){
cookie.data.pageID = bio;
cookie.flush();
}
///button controls

bio.onRelease = function() {
cookie.data.pageID = bio;
cookie.flush();
getURL("index.html", "_self");
}

gal.onRelease = function() {
cookie.data.pageID = gal;
cookie.flush();
getURL("galleries.html", "_self");
}

sample.onRelease = function() {
cookie.data.pageID = sample;
cookie.flush();
}

contact.onRelease = function() {
cookie.data.pageID = contact;
cookie.flush();
}


//sets link depending on what link was clicked

if (cookie.data.pageID == _level0.bio) {
bio.gotoAndPlay(2);
}else(bio.gotoAndStop("tab"));

if (cookie.data.pageID == _level0.gal) {
gal.gotoAndPlay(2);
}else(gal.gotoAndStop("tab"));

if (cookie.data.pageID == _level0.sample) {
sample.gotoAndPlay(2);
}else(sample.gotoAndStop("tab"));

if (cookie.data.pageID == _level0.contact) {
contact.gotoAndPlay(2);
}else(contact.gotoAndStop("tab"));


sorry if it's a bit confused.. any insights welcome! thx all

pigpen32
07-06-2006, 05:11 AM
Try setting cookie.data.pageID as string references instead of movieClips, by using quotes. I think what's happening is that the sharedObject is saving your information (or atleast trying to), but when trying to read them back in, it doesn't recognize that bio is a movieClip object reference, and not a string. So to save the confusion, just save your variables as strings, like so:

cookie.data.pageID = "bio"

not:

cookie.data.pageID = bio

And don't forget to change your if statements as well:

if (cookie.data.pageID == "bio") {

not:

if (cookie.data.pageID == _level0.bio) {

EvolveDesigns
07-06-2006, 12:25 PM
always nice to have an extra set up eyes... thanks pigpen32, works great now ;)

pigpen32
07-06-2006, 03:12 PM
Your welcome. Glad that fixed it.