|
-
Ryan Thomson
[RESOLVED] sharedObject woes....
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:
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
-
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) {
-
Ryan Thomson
always nice to have an extra set up eyes... thanks pigpen32, works great now
-
Your welcome. Glad that fixed it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|