dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Cookies in FlashMX

  1. #1
    Junior Member
    Join Date
    Jul 2002
    Posts
    13
    I am looking for the best way to allow users to skip the first page of a website using an check box and cookies.

    The checkbox would say click here to bypass this page in the future and store a cookie to remember this setting.

    Could some please provide me details on how to set this up? Or is there a better way to do this with FlashMX cookie features?
    Thanks.

  2. #2
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    what you would be looking for is shared objects. shared objects are a kind of cookie used by flash. they are pretty simple and straigth forward to use.

    here is to set up a sharedObject:

    Code:
    mySO = SharedObject.getLocal("name");
    mySO is the instancename of the shared Object. and name is the name of the cookie.

    all data in the shared object is stored in the data property. like this:

    Code:
    mySO.data.myVariable = "something"
    so lets look at that checkbox:

    drag it to stage and enter the label you want. Give it an instace name. lets call it "remember" then in the properties panel set the "change handler" to handle.

    now on the firstframe of the movie add this code:
    Code:
    mySO = SharedObject.getLocal("cookie");
    if(mySO.data.memory)
        gotoAndPlay("scene", frame) 
    /* 
    change scene and frame to the scene name and frame that 
    you want the movie to jump to if the checkbox have been
    checked when the user visited our page.
    */
    
    function handle()
    {
        mySO.data.remember = remember.getValue();
    }
    and that should be it...

    /Mirandir

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center