Welcome, Guest
  • Author Topic: Flash Cookies  (Read 3870 times)

    B-L-A-D-E

    • Seasoned Programmer
    • ***
    • Posts: 221
    • Intermediate Flash Designer/Novice-Programmer
      • MSN Messenger - millerstephen@hotmail.com
      • AOL Instant Messenger - WICKIDxCLOWNxBOY
      • View Profile
      • SWJuggalos
      • Email
    Flash Cookies
    « on: 11/16/02, 20:51 »
    Hey Yall, This IS What I Want To Do...  I Want to Use Flash Cookies To Help Me Make A Voting System Like When you Choose The One You Want And Click Vote It Sets A Cookie (called "vote") That You Already Voted And Makes It So When the mc Loads It Looks For That Cookie And If it Finds It Goes To Frame 3 But If It Doesnt Find It, It Will Goto Frame 1....
    [shadow=Blue,left,300]Stephen Miller[/shadow]
    Aim:WICKIDxCLOWNxBOY
    E-Mail: MillerStephen@Hotmail.com

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Flash Cookies
    « Reply #1 on: 11/17/02, 10:01 »
    You need to use Shared Objects, the new "supercookies" of Flash MX. A little script about this look like this:

    Quote

    localObject = SharedObject.getLocal("info"); //create or read the file is it exists
    if (localObject.didVote!= undefined) { //not new
          gotoAndPlay(3);
    } else { //new user
        didVote= "yes";
        localObject.data.didVote= didVote; //sets the cookie
        localObject.flush(1000); //writes to the created file
        gotoAndPlay(1);
    }


    Jorge

    jonwiz

    • Jr. Programmer
    • **
    • Posts: 70
      • View Profile
      • Jonwiz Media
      • Email
    Re:Flash Cookies
    « Reply #2 on: 11/17/02, 12:03 »
    TUTS

    Just though if you want to learn more about the SharedObject..and how to use it in combination with my ColorSelection Palette to save ColorSchemes.

    « Last Edit: 02/15/03, 21:34 by jonwiz »

    B-L-A-D-E

    • Seasoned Programmer
    • ***
    • Posts: 221
    • Intermediate Flash Designer/Novice-Programmer
      • MSN Messenger - millerstephen@hotmail.com
      • AOL Instant Messenger - WICKIDxCLOWNxBOY
      • View Profile
      • SWJuggalos
      • Email
    Re:Flash Cookies
    « Reply #3 on: 11/17/02, 18:32 »
    So do i put that code on the mc? or what?

    Peace
    [shadow=Blue,left,300]Stephen Miller[/shadow]
    Aim:WICKIDxCLOWNxBOY
    E-Mail: MillerStephen@Hotmail.com

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Flash Cookies
    « Reply #4 on: 11/17/02, 18:40 »
    Put the code in the first frame of _root

    Jorge


    B-L-A-D-E

    • Seasoned Programmer
    • ***
    • Posts: 221
    • Intermediate Flash Designer/Novice-Programmer
      • MSN Messenger - millerstephen@hotmail.com
      • AOL Instant Messenger - WICKIDxCLOWNxBOY
      • View Profile
      • SWJuggalos
      • Email
    Re:Flash Cookies
    « Reply #5 on: 11/17/02, 19:09 »
    Ive Tried All The Places I Thought... Where at?

    Peace,
    [shadow=Blue,left,300]Stephen Miller[/shadow]
    Aim:WICKIDxCLOWNxBOY
    E-Mail: MillerStephen@Hotmail.com

    B-L-A-D-E

    • Seasoned Programmer
    • ***
    • Posts: 221
    • Intermediate Flash Designer/Novice-Programmer
      • MSN Messenger - millerstephen@hotmail.com
      • AOL Instant Messenger - WICKIDxCLOWNxBOY
      • View Profile
      • SWJuggalos
      • Email
    Re:Flash Cookies
    « Reply #6 on: 11/18/02, 23:42 »
    Ive Tried Some Other places But Still Cant get it To Work... where do i put the code?

    Peace
    [shadow=Blue,left,300]Stephen Miller[/shadow]
    Aim:WICKIDxCLOWNxBOY
    E-Mail: MillerStephen@Hotmail.com

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Flash Cookies
    « Reply #7 on: 11/19/02, 15:50 »
    Sorry man, I didn't check fine my script, and forgot to use the data property (in the scond line). Here's again, I hope it works

    Quote

    localObject = SharedObject.getLocal("info"); //create or read the file is it exists
    if (localObject.data.didVote!= undefined) { //not new
         gotoAndPlay(3);
    } else { //new user
       didVote= "yes";
       localObject.data.didVote= didVote; //sets the cookie
       localObject.flush(1000); //writes to the created file
       gotoAndPlay(2);
    }



    You can use trace(localObject.data.didVote) to know id the value exists or not

    Jorge

    3stripe

    • Seasoned Programmer
    • ***
    • Posts: 153
      • View Profile
      • www.3stripe.net
    Re: Flash Cookies
    « Reply #8 on: 04/26/06, 10:25 »
    Nice chunk of code Jorge, just what I was looking for { first go at using cookies :-) }