Friday, May 22, 2015

Thursday, May 21, 2015

How to save data in Adobe Flash (Air for desktop)

How to save data in Adobe Flash (Air for desktop)
var score:Number=0;

var so:SharedObject = SharedObject.getLocal("SaveScore");
     so.data.highScore = score;
     so.flush();
    trace(so.flush());

addEventListener(Event.ENTER_FRAME, savingScoreHandler);

     function savingScoreHandler(e:Event):void{
    
      if(score>so.data.highScore){//--it will save score when current score is grater than previous saving score
            so.data.highScore = score;
        }


///----It creates a "SaveScore.sol" file on

(For WinXP - C:\Documents and Settings\user\Application Data\AppID\Local Store\#SharedObjects\TheBlackSamurai(Special).swf)

(For Win7 - C:\user\user Name\AppData\Roaming\AppID\Local Store\#SharedObject\TheBlackSamurai(Special).swf)

(For Win8 - C:\user\user Name\AppData\Roaming\AppID\Local Store\#SharedObject\TheBlackSamurai(Special).swf)

 ////-----Here AppID means a folder that you create for your app for Air for desktop settings