Postonoh
Postonoh

Reputation: 60

How to detect if flash movie already played for viewer

I am looking to see if there is a way to program to see if movie played on a person machine.

I looking to design and flash movie intro. if played go to home page if not play 30 second promo. Is this possible if so where do I begin to look for information on how to do it.

Upvotes: 0

Views: 68

Answers (2)

IphStich
IphStich

Reputation: 99

I am assuming that all of this is in flash.

At the beginning of movie:

    var played_so:SharedObject = SharedObject.getLocal("PlayedBefore")

    if (played_so.data.before) {
        gotoAndPlay("HomePage")
    } else {
        gotoAndPlay("intro")
    }

And at the end of the intro you will need to put:

    played_so.data.before = true

A SharedObject is somewhat like a cookie. SharedObject's are persistent objects that can be loaded and modified, and are automatically saved. When you modify the data within a SharedObject, it is saved to the user's computer. Using SharedObject.getLocal() loads the object.

I think that only your flash can access your SharedObjects, so the naming of the SharedObject (the parameter passed to getLocal()) can be anything you want.

Here is the link to documentation on SharedObjects: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html

Upvotes: 1

Oded
Oded

Reputation: 499062

Store this information in a cookie. Set a specific value if the movie has been played.

Query the cookie in order to see if the movie has of has not been played and act accordingly.

Upvotes: 0

Related Questions