mayajhon1
asked on
Run Flash movie only once
Hi,
How can I make flash page run only once.
I have a flash page that stops at the end of the movie and I have some navigation buttons.
when I click to go on different page and then I want to go back to the flash page the movie runs again.
I want it to run only once and not over and over again when I press the Back Key.
Thanks Maya
How can I make flash page run only once.
I have a flash page that stops at the end of the movie and I have some navigation buttons.
when I click to go on different page and then I want to go back to the flash page the movie runs again.
I want it to run only once and not over and over again when I press the Back Key.
Thanks Maya
ASKER
Thanks,
for some reason the variable always setup to 1 and it doesn't play even once always stops at the last frame.
on the last frame:
set (test1,1);
stop();
on the first frame:
if (test1=1) {
gotoAndStop(100);
}
Thank you,
Maya
for some reason the variable always setup to 1 and it doesn't play even once always stops at the last frame.
on the last frame:
set (test1,1);
stop();
on the first frame:
if (test1=1) {
gotoAndStop(100);
}
Thank you,
Maya
The only way to do this is set a non-persisent (session) cookie that gets set to "1" or "true" when the website visitor first hits the page. Then on subsequent reloads of that page, check the cookie and if it's set to "1" or "true" (however you choose to do it), load a different flash movie that only displays the last frame.
Short version:
make 2 flash movies, 1 that is the whole thing, another with just the last frame and then load the appropriate movie based on wehter the user has been to the page before.
You can use asp, php, javascript for such functionality.
Short version:
make 2 flash movies, 1 that is the whole thing, another with just the last frame and then load the appropriate movie based on wehter the user has been to the page before.
You can use asp, php, javascript for such functionality.
ASKER
Thanks disentropy,
Do you have any code exampe example?
Do you have any code exampe example?
For what language?
ASKER
If I understand correctly I will add this code the the html that has the flash movie and to the home.html page.
so any language that I can add to my html(s) pages.
I tryed something like that:
in the home.html head section
<CFCOOKIE NAME="TEST" VALUE="Y">
on the .html that the flash is in I added (I put images insted of flash for testing)
<cfif cookie.TEST EQ 'Y'>
<img src="first.jpg" width="75" height="120">
<CFELSE>
<img src="second.JPG">
<CFCOOKIE NAME="TEST" VALUE="Y">
</CFIF>
for some reason this didn't work It showed both images at once so I'm not sure what I'm doing wrong.
so any language that I can add to my html(s) pages.
I tryed something like that:
in the home.html head section
<CFCOOKIE NAME="TEST" VALUE="Y">
on the .html that the flash is in I added (I put images insted of flash for testing)
<cfif cookie.TEST EQ 'Y'>
<img src="first.jpg" width="75" height="120">
<CFELSE>
<img src="second.JPG">
<CFCOOKIE NAME="TEST" VALUE="Y">
</CFIF>
for some reason this didn't work It showed both images at once so I'm not sure what I'm doing wrong.
Looks like you are using Cold Fusion in your HTML page. If so, then this will have to have the cold fusion extension (.cfm) instead of the .html extension in order for tha page to process the Cold Fusion Code that tests for the cookie.
If you are familiar with javascript, you can take a look at the following for creating cookies with javascript:
http://www.quirksmode.org/js/cookies.html
You will need to add the logic for testing the cookie and then using document.write('<img src="first.jpg" width="75" height="120">') as then javascript for outputing your img or object tag.
If you are familiar with javascript, you can take a look at the following for creating cookies with javascript:
http://www.quirksmode.org/js/cookies.html
You will need to add the logic for testing the cookie and then using document.write('<img src="first.jpg" width="75" height="120">') as then javascript for outputing your img or object tag.
ASKER
thanks, I'll study it over the weekend.
I guess I didn't know what I'm doing with this CF just tried an example without any background...
I'll let you know over the weekend and I'll raise the point value as well.
Have a nice weekend
Maya
I guess I didn't know what I'm doing with this CF just tried an example without any background...
I'll let you know over the weekend and I'll raise the point value as well.
Have a nice weekend
Maya
Your welcome. Sounds good...
ASKER
Hi Disentropy,
I came across this code:
// this script might go in index.html
var cookies = new Object();
// immediately set a cookie to see if they are enabled
document.cookie = "cookiesenabled=yes";
extractCookies();
if (cookies["cookiesenabled"] == "yes")
{
if (cookies["returninguser"] == "true")
{
location.href = "/content.html";
}
else
{
var expiration = new Date();
expiration.setYear(expirat ion.getYea r() + 2);
// cookie expires in 2 years
document.cookie = "returninguser=true; expires=" +
expiration.toGMTString();
location.href = "/introduction.html";
}
}
I think this is what I need but I don't know how to put all of this to the .html page.
Thanks
Maya
I came across this code:
// this script might go in index.html
var cookies = new Object();
// immediately set a cookie to see if they are enabled
document.cookie = "cookiesenabled=yes";
extractCookies();
if (cookies["cookiesenabled"]
{
if (cookies["returninguser"] == "true")
{
location.href = "/content.html";
}
else
{
var expiration = new Date();
expiration.setYear(expirat
// cookie expires in 2 years
document.cookie = "returninguser=true; expires=" +
expiration.toGMTString();
location.href = "/introduction.html";
}
}
I think this is what I need but I don't know how to put all of this to the .html page.
Thanks
Maya
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank You,
Maya
Maya
Not sure what it will do on a page reload. If that does not work, how about a cookie?