Fourth step: Saving people's patience
I decided to leave a cookie on the first visit a user makes to a page. When the user returns, the server reads the cookie and knows they've watched that movie before, so it replaces the movie with a flat of the final frame and a little play button, as well as displaying the content straight away. A little time on Google and you could do this with Perl, PHP, JavaScript, etc., but being quite handy with ASP, this was my weapon of choice. There were two parts to it:
1) Checking for the cookie and showing the appropriate content:
Simply an If statement - if the cookie is empty or doesn't exist then embed the Flash movie (which of course will show the hidden layers at the end of it's play), otherwise show the flat JPG image of the last frame and 'switch on' the hidden layers.
2) Writing the cookie.
<% Response.Cookies("viewed")("force") = "True"
Response.Cookies("viewed").Expires = Date + 90 %>
As soon as someone visits the page and it is rendered for the first time in the browser, the cookie is written so you never bother him or her needlessly again. The only thing remaining is what if they want to see the movie again? I made a simple script called clear.asp and had a 'Play again' button with the following link attached:
<a href="clear.asp?url=force.asp&cookie=force">Play
again.</a>
As you can see, the link carries the page you are on and the name of the cookie you need to wipe in the querystring to the script. It looks like this (again in ASP):
<% strURL = Request.QueryString("url")
strCookie = Request.QueryString("cookie") Response.Cookies("viewed")(strCookie)
= "" Response.Redirect strURL %>
All I'm doing is getting the URL and cookie name from the query string, wiping the appropriate cookie and redirecting the user back to the page they were on. Why do that? Well, simply wiping the cookie on the same page doesn't do it. It's too late. You need to reload the page too. This was my solution. And that's it. We're all done and it works beautifully*.
* as tested in IE5 and 6, Mozilla and Netscape.