Shared objects (last frame visited)

hello,

having trouble with flash shared objects.
i want the SO to remember the last frame the user visited.
both are stop frames that can only be reached by button navigation. here is my code so far:

//first frame of movie. no SO = play. SO present = go to last frame
so = sharedobject.getlocal(“lastframe”);
if (so.data.frame == undefined){
play();

} else {
this.gotoAndStop(so.data.frame);
}

//here is the code for the last frame visited
//again, this code is only on two frames

stop();
function rememberme() {
so.data.frame = this._currentFrame;
}

help, what am i doing so wrong?

Why don’t you stored the last location in an array? http://moock.org/asdg/codedepot/ go to chapter 11 and back button with history.

thanks!
ill have to try that tonight.
i will let you know how it works.

*but the point is so the when the user returns to the movie, the last frame they visted in the movie will now be the first.
this will be stored localy via the shared object.

Well, do you have problems saving the data or retrieving it? Did you test? And did you test it on a server or simply offline?

pom :q:

it looks like i have trouble saving the frame the user was last on.
the second part of the script goes on each frame you want to be remembered. that way it records the frame number last viewed to the correct data field in the shared object to be retrieved on the next visit.

i tested on my server. all shared objects work via a domain name for storing and calling the SO.

thanks all for any help.

Well, what’s your script to write in the SO?

hay, maybe it’s late but still , try this it should work

//in the first frame, use this code

stop();
so = SharedObject.getLocal(“lastframe”);
if(so.data.frame == undefined)
{
play();
}
else
{
gotoAndStop(so.data.frame);
};

// try to keep ur codes on a separate layer for example: (scripts)
//then on the frame than u need to record the possition off, the
//ones you said you can only reach by navigation, use this code.

so.data.frame = _currentframe;
stop();

// place the stop() after the code, this might be ur mistace.
// or it might be the fact that u wrote a function and did not call it
//when u write functions and u need to use them , like u did, u
//have to use a function call, see more in the flash help.

i hope this helps.

yours

you own!

thanks for your help.
cant wait to get home and try it out.

no problem.
keep in mind that once it works, ur moviw will start in the frame that u visited last , so if your navigation button does not allow u to get to the first frame again, then you will not be able to do so unless you find the lastframe.as, in ur system and delete it. i mean with lastframe.as, the file into wich the sharedobjects are stored, this is created by the flash player.

enjoy