all groups > flash actionscript > february 2006 >
You're in the

flash actionscript

group:

Re: Want Flash movie NOT to replay every time web page is reloaded



Re: Want Flash movie NOT to replay every time web page is reloaded pwiop
2/1/2006 11:13:35 PM
flash actionscript: If you so wished

You could create an initial variable called something like
var has_flash_played
the first time the mc is played it sets this variable to 1.
Your flash file on loading would look for this variable in the shared object
and react using code something like;

if(my_shared_object.has_flash_played==1){
gotoAndStop('lastFrame")
}
Re: Want Flash movie NOT to replay every time web page is reloaded pwiop
2/1/2006 11:21:45 PM
try this

//declared shared object and name your variable
var my_shared_object:SharedObject = SharedObject.getLocal("has_flash_played");
//check to see if shared object has been created
if (my_shared_object.data.has_flash_played == 1) {
//if shared object has been created go to last frame of movie
trace("mc has been played");
//gotoAndStop("lastframe_of_mc")
} else {
//create the shared object
trace("creating shared object");
//set variable to indicate has been playd
my_shared_object.data.has_flash_played = 1;
//populate variable with new variable value
my_shared_object.flush();
}
Re: Want Flash movie NOT to replay every time web page is reloaded cysuzanne
2/1/2006 11:28:48 PM
Thank you for the code below...but at the expense of sounding like a total
idiot, where am I placing that code you mentioned in your last post? (Remember
I am a newbie.) In the HTML on the web page or on the first frame of the mc? I
have a separate layer in my .fla file for actions....
Re: Want Flash movie NOT to replay every time web page is reloaded pwiop
2/1/2006 11:31:27 PM
Re: Want Flash movie NOT to replay every time web page is reloaded cysuzanne
2/2/2006 12:00:00 AM
I must not be doing something right, because I can't get it to work. I copied
your code and pasted it in the actionscript window, on the first frame in my
actions layer. I changed the gotoAndstop to the number of my last frame. I
tried even uncommenting that gotoAndStop line and I still can't get it to work
(even added a semi-colon to the end of that line). Any other ideas? I'm sure
it's something simple that I'm just missing...

Even after I replaced the SWF file in my main site directory, I emptied the
cache in my browser and went to the home page where the mc plays and stops the
first time, went to another page, came back to the home page and the mc still
plays again. Help!
AddThis Social Bookmark Button