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



Monday, October 27, 2014

How to prevent Flash stealling content

If someone steal your flash content and use to his own website you can redirect his website to yours by using below script into your flash project.

Suppose your domain is www.abc.com and other domain name is www.def.com or anything. Just use below script into your flash file.

import flash.events.Event;
var webOne = navigateToURL(new URLRequest("http://www.abc.com"), "_self");
var webTwo = navigateToURL(new URLRequest("http://www.def.com"), "_self");

content.addEventListener(Event.ENTER_FRAME, fl_ClickToGoToWebPage);

    function fl_ClickToGoToWebPage(event:Event):void

    {
       
        if(!webOne){
           
            webOne;
        }
       
    }
That's it.............Thanks