Bloo Apple
Home Games and Movies

Games and Movies

Games and Movies Games and Movies
Latest Game
Pokemon Match
Coming Soon...
Droppin Beats 4
Paper Mario Maze
Want Action?
Join me on my next project to be part of something awesome
 
 
 
 
 

Saving Local Data

Shared Objects is a way of creating a cookie and placing it on your computer so when ever you execute your game it will go to that file and place what ever you have placed in a shared object variable. When ever you run a code for the first time it will not place any of the code on the stage from the shared object because none have been placed into the shared object, or cookie. However the second time you run the code it will call the shared object and place data into your flash. A Shared Object is another type of variable. You can try this code by placing the code inside a frame on a actionscript3.0 document.

undefined

//firstcall the shared object and initialize it.
var myLocalData:SharedObject = SharedObject.getLocal("mygamedata");
//test the code
trace(myLocalData);
//Then to save your data you must tell the document to do this action
myLocalData.data.gameinfo = "saved";

saved

The Break Down.. First you must call the data, then you do some action to see if it has been called correctly. Then the last line of code saves what ever you have placed into your gameinfo. You also have to create variables with variableNames.

Site Created July 17, 2009