PDA

View Full Version : Saving data from Flash.


mridgers
02-10-2003, 05:12 PM
Is there a way to save data locally so that a Flash projector can continue from where it left off next time it is turned on? I am currently developing a project that needs Flash to adjust and remember whether a house is sold or not.

Thanks...
-Martin.

De-Cypher
02-10-2003, 05:21 PM
you could have flash read and write cookies if it where on the web, but the way to go for your situation is with Local Sharedobjects:

http://www.macromedia.com/support/flash/action_scripts/local_shared_object/

They allow you to hold structured data that resides on the users computer. It cannot be wiped out by clearing cache or deleting cookies. You get 100k of space to use (depending on user settings) read about in the link i put above.

Michael Chen
02-11-2003, 06:14 AM
Yeah, there is a way but I don't actually know how.

I think it's called "SharedObjects". The Flash Player allows you to store up to 100KB on the viewers computer .

I think this is how it goes: (simple example)

//Initialization
newSharedObject = SharedObject.getLocal("newData");

//to save data
//here we are trying to save the coordinate of the movieclip called
//newMovie in a variable called newMovieX, and
//flush is the method that stores the data.
newSharedObject.data.newMovieX = newMovie._x;
newSharedObject.flush();

//to retreive the stored data
newMovie._x = newSharedObject.data.newMovieX;


Note: This is just my assumptions, some may be correct and some may not.

Double check with the gurus in FlashKit :)


Hope that helped :D

mridgers
02-11-2003, 09:28 AM
Spot on. Thanks De-Cypher and Rukuwa.

CGTalk Moderation
01-14-2006, 10:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.