If you’ve ever found yourself wishing that there was a way to keep your game on just a couple sites without it spreading, then it sounds like sitelocking is what you need. Sitelocking allows you to ‘lock’ your game to a site, or a couple sites, so when someone tries to play it on another site it will be unplayable. It’s useful when you are uploading an unreleased game or are selling a non-exclusive license to a site. Here’s how you can sitelock your game. In this code I am using ActionScript 2.

urls_allowed = ["mindjolt.com"
,"www.mindjolt.com"
,"myspace.com"
,"www.myspace.com"
,"facebook.com"
,"www.freelanceflashgams.com"
,"freelanceflashgames.com"
,"devstatic.mindjolt.com"
];//sets up an array that stores the sites which you want to be sitelocked.
 
sitelock(urls_allowed);//runs function sitelock
 
function sitelock(urls_allowed) {//sets up sitelock function
 
lock = true;//sets variable lock to true
 
domain_parts = _url.split("://");//allows for a :// in the domain name
 
real_domain = domain_parts[1].split("/");//allows for a /
domain.text = real_domain[0];
for (x in urls_allowed) {
if (urls_allowed[x] == real_domain[0]) {//if the domain is correct
lock = false;//sets variable lock to false
}
}
if (lock) {//if locked
_root._visible = false;//the flash is invisible.
}
}

Related posts:

  1. The Easy Way to Sitelock your Game in AS2
  2. Code Bits: Variables
  3. Code Bits: Set Interval