|
-
shared object question
I have a .SWF file that is a navigational menu on a page, menu has several links and it is inserted in several HTML's ... there are some animations in this movie before the actual link buttons appear. So, a user comes, the animation plays, the links appear and he clicks on any of the links, in the next HTML, where the same movie is inserted, i want the animation to be take directly to a specific keyframe without having to play what's ahead of that keyframe.
I know that this is possible with some javascript, but i have tried with .SOL files, so i have the following script :
in frame 1:
code:
local_data = SharedObject.getLocal("once_data");
stored_once = once_data.data.once;
if (once_data.data.once == "2") {
this.gotoAndStop(50);
}
in last frame i have:
code:
local_data.data.once = "2";
local_data.flush ();
i have checked, the .SOL object is created, i have looked inside the file, and value "2" is there.
the problem is that when cliked on any of the links from the movie, the entire animation plays from beginning and doesen't care about my "if" from above.
anybody could tell me what i have done wrong ?
thank you very much.
-
The Flashman
Re: shared object question
Originally posted by maydays
local_data = SharedObject.getLocal("once_data");
stored_once = once_data.data.once;
if (once_data.data.once == "2") {
this.gotoAndStop(50);
}
Take a look at the 2nd line:
code:
stored_once = once_data.data.once;
once_data is the name of your file and NOT the name of the shared object, which is local_data. Therefore, your second line should be:
code:
stored_once = local_data.data.once;
and ur if statement should read:
code:
if (local_data.data.once == "2") {
this.gotoAndStop(50);
}
or simply:
code:
if (stored_once == "2") {
this.gotoAndStop(50);
}
i eat actionscripts for breakfast
-
thank you very much.
that worked out.
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
|