Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I just need to know how to save my mobile AIR game levels on local machine. Like all the details should be get save eg. how much level i finished or opened once and played, those levels should be in unlocked state. If the level which was never open before will be in locked state. This is my concept and this is the concept used in all mobile games nowadays. kindly please go through any mobile game level type and please let me know the coding for my concept its very urgent. And Thanks in advance. Any help will be kindly appreciatable.

The code which 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 the text document is getting write to my local machine. But i don't know how to check the levels which are locked are unlocked using this . i kept my level buttons on stage itself by using frames for lock and unlock position. Thanks in advance.

like image 867
Siva Avatar asked Jun 13 '12 10:06

Siva


1 Answers

  1. You can use the built in SQLite feature of Adobe AIR. For this you can create a local database that you can query later.

OR

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

Personally, I would go for encrypted SQLite so you can get out of "hacking" scores by the "bad" guys :)

like image 195
Adrian Pirvulescu Avatar answered Oct 05 '22 23:10

Adrian Pirvulescu