Storing Data Similar to Cookies
Description: Store data with flash so that data remains after closing an applet.
Author: John Bezanis
Added: March 29th 2007
Version: Flash 8
Flash uses Shared Objects to allow data to be stored even after a user closes a flash applet. This is very similar to a browser's use of cookies. Main code in the applet:
- //Select the local shared object
- var so:SharedObject = SharedObject.getLocal("setbgcolor");
-
//check if the bgcolor has been previously set
- if(so.data.bgcolor!=undefined){
- //if set, set the background color to that color
- setcolor(so.data.bgcolor);
- }
- //set the background color and save it.
- function setcolor(color){
- var bgcolor = new Color(bg);
- bgcolor.setRGB(color);
- so.data.bgcolor=color;
- //force the file to be written
- so.flush();
- }
Download Source File
Comments
April 18th 2007 05:04AM - Stefan
Hey Stefan,
You could use an if statement to see if the music has been set to on or off, or if it is not set.
You could use an if statement to see if the music has been set to on or off, or if it is not set.
April 19th 2007 01:04AM - John
Hello,How can I store data in flash
September 6th 2007 02:09PM - jp
hi, ay i want to make it so when the player gets up to a certain question in mi quiz, when they close it then re open it, its exactly where they left it, any suggestions on the code to do that??
January 21st 2008 03:01AM - pioallergenic
Hi,
Can u tell me how to change shared object pathe from "C:\Documents and Settings\Harish\Application Data\Macromedia\Flash Player\#SharedObjects\D8F43EBD\localhost\Sample\Sample.swf" to My "D:\Sample" folder. u can send solution to harish_neermarga@rediffmail.com
Plse help..
Thank you
Can u tell me how to change shared object pathe from "C:\Documents and Settings\Harish\Application Data\Macromedia\Flash Player\#SharedObjects\D8F43EBD\localhost\Sample\Sample.swf" to My "D:\Sample" folder. u can send solution to harish_neermarga@rediffmail.com
Plse help..
Thank you
June 13th 2008 01:06AM - Harish
How do you make a object create from another object, and make a enemy that disappears after hit by another object?
June 14th 2008 12:06PM - Dragonblue80
hello how to store the data obtained through the flash .....
as in the case of a data obtained through a questionnaire?
please send to drthomassebastian@rediffmail.com
as in the case of a data obtained through a questionnaire?
please send to drthomassebastian@rediffmail.com
December 8th 2008 08:12PM - thomas
Does anyone know how to store a lot of data into a Flash file (a whole sequence of mousemoves) to be retrieved later? Please respond to JacyJ1@aol.com
November 2nd 2009 01:11PM - joyce
good
November 6th 2009 09:11AM - vigrx
That is an awesome cube, thanks for sharing.
December 13th 2009 07:12AM -
Thanks, I used it in this application
http://wickedwolf.x10hosting.com/flash/kana/
to store which checkboxes are checked and the score
http://wickedwolf.x10hosting.com/flash/kana/
to store which checkboxes are checked and the score
December 19th 2009 02:12PM - wicked wolf
I have Designed A Website In Flash . I Want That Users Can Store Data (Or Post A Comment That Can Be Seen On My Site Any Time I Visit it
December 29th 2009 10:12PM - Nishant
Thanks for sharing these info with us! I was reading something similar on another website that i was researching. I will be sure to look around more. thanks...
January 15th 2010 08:01PM - evening dresses
This can definitely be something that can be used at a design website. It can help people select their color hue.
January 20th 2010 08:01PM - Swimsuit Modeling
Useful tutorial..
January 24th 2010 10:01AM - Ares 4
Special thank for good post.
February 5th 2010 09:02PM - โหลดเพลงà
Thank for the information
February 6th 2010 07:02AM - โหลดเพลงm
Special thank for good post.
February 10th 2010 04:02AM - โหลดเพลงà
Special thank for good post.
February 10th 2010 08:02AM - โหลดเพลงà
Add a Comment






I have turn on/off music button on my web site. How can I store data if music is on or off. Thank u in advance.