There are a couple of ways to do this, all of which require you to be able to actually define what a session is.
Does that mean, once I surf to your site, on subsequent visits the flash movie won't play anymore? This is usually accomplished with the presence of cookies, and typically breaks if the user has cookies turned off or clears their cache. The second thing is to define the behavior of the page once your flash movie is complete. Are you saying that it shouldn't show up any more at all? Or are you just saying that it should only be allowed to play once and the controls get disabled? >From a logic standpoint, all you are doing is testing the presence of a permanent cookie. The setting of that cookie occurs the first time the page loads for a given user. If the cookie is already present, then you can pass a flag to your .swf or even suppress the code that embeds the .swf file. There are two points to check/affect that logic. On page load, and when your movie is done playing. Whatever you consider the "flag point" of having viewed your .swf file, you can attach javascript that says, " .setCookie(cookiename, expdate) --- look up on the interwebs the specific format for a javascript cookie or grab some code that makes cookies easier to manage. The other point is on page load where you do the same thing. The key with the javascript angle is that the cookies won't truly be set/reset until another page load. So if you want to suppress the user from clicking without moving from the page, you'll have to set up a javascript function once the movie finishes playing to make it so you can't replay it. This might involve passing special parameters to your .swf if it's say a movie with controls that you can hide/suppress with flags. I've probably made this explanation far more complex than it needs to be. If what I've said doesn't make sense, go back to the beginning. Define what a session is (for you) and how you want the page to behave/ appear to the user. Then we can add some input. That said, this isn't really an SWFObject issue as much as how to play with sessions/cookies/javascript question, so you might have better luck in other forums. Best, Vincent On Feb 27, 6:29 am, Happy Sadhu <[email protected]> wrote: > Hi, > I would like to play some flash files on a site only once per session > rather than every time the page is clicked. > > I am embedding the SWF with JavaScript: > > <script type="text/javascript"> > swfobject.embedSWF("myContent.swf", "myContent", "300", "120", > "9.0.0"); > </script> > > Any help is appreciated, > Sam Miller -- You received this message because you are subscribed to the Google Groups "SWFObject" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/swfobject?hl=en.
