Flash Cookies!

This is a discussion on "Flash Cookies!" within the Flash & Multimedia Forum section. This forum, and the thread "Flash Cookies! are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 3rd, 2003, 12:09
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Flash Cookies!

Hmmm...Cookies! Double chocolate is my favourite...

Ok.... Flash Cookies!

You don't need a javascript... In fact, even if someone has disabled javascripts, a flash cookie will still work!
There is no way to disable flash cookies on ALL sites. You can disable them on individual sites that you specify however, by right-clicking and choosing "settings". Then if you click on the second tab "Local Storage" you can change what flash can and can't store.

But onto the actual scripting!

Ok, you have to create a shared object in flash, which you can then read to and write from (as much data as you want). Technically, you could store a book in there if the user allowed you to store that much data, but we want one variable, such as "visited_before" or something similiar, that flash can check and, if it is equal to "here", then the movie can take appropriate action, such as not playing and instead redirecting to an url.

Code: Select all
_root.shareObj = SharedObject.getLocal("shareObj");
if (_root.shareObj.data.check == "here") {
    stop();
    getURL("page.html");
} else {
    trace("Writing Shared Object (Flash Cookie)...");
    _root.shareObj.data.check = "here";
    _root.shareObj.data.flush();
}
This code checks if the variable "check" (in the shared object) is equal to the text "here" and, if it is, it stops the movie and gets the page.html url.

If the variable is not equal, or not there (the else clause) then the code writes the variable and flushes (writes) the data to the cookie object.

You can find an example here:

Flash FLA:
http://www.digital-end.com/webforumz...ash_cookie.fla

Online Example:
http://www.digital-end.com/webforumz...sh_cookie.html

Hope this helps!! lol... It's some very useful stuff! Remember you can store anything in there, including, for example, user details or preferences!

Closed Thread

Tags
flash, cookies

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
hey up cookies about cookie456 Introduce Yourself 7 Jun 12th, 2008 08:30
cookies in PHP marquey PHP Forum 4 May 31st, 2007 17:17
how to store cookies selphie08 Flash & Multimedia Forum 3 Sep 20th, 2006 01:54
ASP Cookies señorbadger Classic ASP 6 Nov 22nd, 2003 14:04
Flash+cookies icthecat Flash & Multimedia Forum 1 Oct 31st, 2003 06:32


All times are GMT. The time now is 04:29.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43