• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to store game save data ?

Explorer ,
Mar 22, 2010 Mar 22, 2010

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.

TOPICS
ActionScript

Views

991

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Mar 22, 2010 Mar 22, 2010

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.

Votes

Translate

Translate
Enthusiast ,
Mar 22, 2010 Mar 22, 2010

Copy link to clipboard

Copied

You can use SharedObject to store flash cookies

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 22, 2010 Mar 22, 2010

Copy link to clipboard

Copied

Thanks. can i use array for store cookies?  I need to store 1000 lines of data. is it passible ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 22, 2010 Mar 22, 2010

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);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 22, 2010 Mar 22, 2010

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 22, 2010 Mar 22, 2010

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 22, 2010 Mar 22, 2010

Copy link to clipboard

Copied

LATEST

Thank you very much. I will do it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines