Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : shared objects in slides - a screen too far?



Conor
3/4/2004 10:26:46 PM
Hello,

Finally got shared objects working from this example
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictiona
ry/actionscript_dictionary651.html

(thanks for the pointer Urami (I had posted in general flash forum (sorry,
only saw this forum for a.s. today)))

Example A (below) shows how it's been tweaked:

However, I'm now trying to modify this to work in a slide presentation.
Where it remembers what slide you were last on instead of what frame.

I've changed it to reflect slides instead of frames without luck.
Example B (below).

Any pointers would be much appreciated.

Thanks,

--


Conor




working Example A:
_____________________

// Get the kookie
so = sharedobject.getlocal("kookie");

// Get the user of the kookie and go to the frame number saved for this
user.
if (so.data.frame != undefined) {
this.gotoAndStop(so.data.frame);
}

// On each frame, call the rememberme function to save the frame number.
function rememberme() {
so.data.frame=this._currentFrame;
}
_____________________




non-working Example B
_____________________

// Get the kookie
so = sharedobject.getlocal("kookie");

// Get the user of the kookie and go to the frame number saved for this
user.
if (so.data.Slide != undefined) {
this.gotoSlide(so.data.Slide);
}

// On each frame, call the rememberme function to save the frame number.
function rememberme() {
so.data.Slide = this.currentSlide;
}
_____________________

Ed Skwarecki
3/15/2004 1:24:16 PM
I know this reply is kind of late, but...

what you're trying to save is an object instance. That won't work. You should instead
try something like this:

// Get the kookie
so = sharedobject.getlocal("kookie");

// Get the user of the kookie and go to the frame number saved for this
user.
if (so.data.Slide != undefined) {
this.rootSlide.currentSlide.gotoSlide(eval(so.data.SlidePath));
}

// On each frame, call the rememberme function to save the frame number.
function rememberme() {
so.data.SlidePath = targetPath(this.currentSlide);
}

Also, it is better practice to call this.rootSlide.currentSlide than just this.gotoSlide.

--
Ed Skwarecki
Principal Architect
eLearning
AddThis Social Bookmark Button