Forum Moderators: open

Message Too Old, No Replies

Can a Flash object autoplay only once a session?

         

Jon_King

6:28 pm on Nov 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can a Flash object autoplay only once during a user visit to a site? In other words, can a Flash animation which plays when a page is loaded not replay if the visitor goes back to that page using the back button or a nav link?

-Jon

lorax

9:18 pm on Nov 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes but you'll need to write some ActionScript to accomplish this. You could set a var for the current datetime and check it whenever the movie is loaded.

The better way to accomplish this would be to use a script language and check to see if the user has been to the page at all that day and if not, then load the Flash file.

bird

1:45 am on Nov 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am just pondering a similar question. My problem is, that I want a flash animation (actually the user interface to a remote application) to return to its previous state when the user displays the page again during the same session.

The best approach I have found so far is to set a cookie through javascript, and to check that cookie during initialization of the movie. There are some trickeries involved, but it seems to be possible. If the movie is loaded like this:

<embed swLiveConnect="true" id="my_movie" name="my_movie".....>

then you can set a cookie in ActionScript like this:

GetURL("javascript:document.cookie='my_cookie_data;expires=Mon, 7 Feb 2000 23:19:15 UTC'; return false;");

The value of the cookie can then be fetched again like this:

GetURL("javascript:document.my_movie.SetVariable('in_cookie', (document.cookie)? document.cookie : ''); return false");

which will place the data value of the cookie in the global ActionScript variable "in_cookie".

WARNING: I didn't test this yet, just found it somewhere. But it looks reasonable enough that it will probably work, although some further investigation is still required.