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 Currently Disabled





