Flash AS3: How to save levels of an AIR mobile game on a local machine?

I just need to know how to save levels of AIR mobile games on a local machine. Like all details, you need to get a save, for example. how many levels I finished or opened once and played, these levels should be in an unlocked state. If a level that has never been opened will be in a locked state. This is my concept, and this is the concept used in all mobile games these days. kindly go through any type of mobile game level and please let me know that the coding of my concept is very relevant. And thanks in advance. Any help would be kindly understood.

The code I used is below: Flash AS3

var file = File.applicationStorageDirectory.resolvePath("test.txt"); 
var str = "Locked Levels : Level 1,Level 2,Level 3,Level 4"; 
file.addEventListener(Event.COMPLETE, fileSaved); 
file.save(str); 
function fileSaved(event) 
{ 
    trace("Done."); 
}

In the above code, a text document gets written to my local machine. But I do not know how to check levels that are locked, unlocked with this. I held the level buttons on the stage itself, using frames to lock and unlock. Thanks in advance.

+5
source share
2 answers
  • You can use the built-in SQLite function for Adobe AIR. To do this, you can create a local database, which you can query later.

OR

  1. Save the data in the applicationstoragefolder in your own format so you can read it later and interpret it.

Personally, I would go for encrypted SQLite so that you can get out of the “hacker" points by the "bad" guys :)

+3
source

All Articles