Is it possible to access the same shared object from different flash movies. I am trying this, and I put the exact same code to access the shared object in the first frame of both movies, but when I update the SO in one of the movies, the other one does not reflect the change. Both movies are in the same folder. Any ideas?
Since it is called a "shared object, I would think that more than one movie could access it, but what do I know.
I donāt know if it matters, but here is the code:
// Get the user's name from the cookie
user = SharedObject.getLocal("user_profile");
// If the user has not set up a name, call them Guest. If thay have already set a name, call them that.
if (user.data.userName == undefined) {
user.data.userName = "Guest";
user.flush()
userName = "Guest";
} else {
userName = user.data.userName;
}
_root.gotoAndStop("done");
well, thereās just a little trick to it, coz every movie will save to itās own folder, based on itās url, in the general āshared objectsā folder (did you ever check whatās in thereā¦?)ā¦
unless instructed otherwise!
now, young obi wan, to achieve this, how can i? asking you areā¦?
well, ask no more, simple is the task when the force is with you!
(sorry, just felt like a bit of fun in all these coding questionsā¦thanks for having read this farā¦so the answer isā¦i forgot!..joking! )
this is the important line:
user = SharedObject.getLocal(āuser_profileā);
because you can pass it another parameter:
a target folder/ path!
(sharing one of the best kept flash secrets here, better move this to the best of section later! lol )
so: user = SharedObject.getLocal(āuser_profileā, ā/ā);
will save all your SO in the main/master directory/folder,
or replace by for example
user = SharedObject.getLocal(āuser_profileā, ā/testā);
or whateverā¦in both movis the same of course!!