Copy link to clipboard
Copied
I am making some word game I need to save my data into PC. I don't know How to do it. Please guide me to save data to pc permanently.
If you want to store data from the input textfields, you just add the text to an array.
Save the array in to flash cookies when you want(on mouse click or some other event).
When you want to recover the data just call the saved array from the cookie.
It is all in the last posted comment.
In that code saving an array(testarray) as flashcookie.
When first running the code you will get saved data as undefined.
When you run the code once again you will get the saved array.
Copy link to clipboard
Copied
You can use SharedObject to store flash cookies
Copy link to clipboard
Copied
Thanks. can i use array for store cookies? I need to store 1000 lines of data. is it passible ?
Copy link to clipboard
Copied
Sure you can save arrays also
var mySo:SharedObject;
mySo = SharedObject.getLocal("application-name");
trace("loaded value: " + mySo.data.savedValue + "\n\n");
var testArray:Array = new Array(1,2,3,4,5,6,7,8);
saveValue(testArray);
function saveValue(testArray):void {
mySo.data.savedValue = testArray;
var flushStatus:String = null;
try {
flushStatus = mySo.flush(10000);
} catch (error:Error) {
trace("Error...Could not write SharedObject to disk\n");
}
if (flushStatus != null) {
switch (flushStatus) {
case SharedObjectFlushStatus.PENDING :
trace("Requesting permission to save object...\n");
mySo.addEventListener(NetStatusEvent.NET_STATUS, onFlushStatus);
break;
case SharedObjectFlushStatus.FLUSHED :
trace("Value flushed to disk.\n");
break;
}
}
}
//to clear the cookie call this function
//clearValue();
function clearValue():void {
trace("Cleared saved value...Reload SWF and the value should be \"undefined\".\n\n");
delete mySo.data.savedValue;
}
function onFlushStatus(event:NetStatusEvent):void {
trace("User closed permission dialog...\n");
switch (event.info.code) {
case "SharedObject.Flush.Success" :
trace("User granted permission -- value saved.\n");
break;
case "SharedObject.Flush.Failed" :
trace("User denied permission -- value not saved.\n");
break;
}
mySo.removeEventListener(NetStatusEvent.NET_STATUS, onFlushStatus);
}
Copy link to clipboard
Copied
Sir, I need to store data from input text filed and store it to array. when I click button i have to recovery all datas from .sol file. I don't know how send data through input text. guide me please.
Copy link to clipboard
Copied
If you want to store data from the input textfields, you just add the text to an array.
Save the array in to flash cookies when you want(on mouse click or some other event).
When you want to recover the data just call the saved array from the cookie.
It is all in the last posted comment.
In that code saving an array(testarray) as flashcookie.
When first running the code you will get saved data as undefined.
When you run the code once again you will get the saved array.
Copy link to clipboard
Copied
Thank you very much. I will do it.