Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to upload my game to Kongregate and other sites, but on Kongregate I want to invoke one function and other sites I want run another function. How to check in AS3 where (I want to get host like: or etc) my game is? Or maybe you know other, better way to make this?

share|improve this question

I found a post on how to site-lock flash movies/games here. It is the fourth post down. You can modify it slightly to make it do something or set any variables you need changed.

Here is the code from the post.

//Assuming you have a movieclip or sprite named myMovieClip (you can use any movieclip or sprite)
var URLofSWF:String = myMovieClip.loaderInfo.loaderURL;

//You will do some string methods to get domain name etc etc, it's up to you
var domain_parts:Array = _url.split("://");
var domain_parts_2:Array = domain_parts[1].split("/");
var domainOfURL:String = real_domain[0];

 //Then you compare the URL to any URL you wish to allow or disallow
if(URLofSWF == ""){ // strict swf url checking
stopEverything(); // Or inject some funny code to the stealer :P
// or 
if(domainOfURL == ""){ // domain checking only
    stopEverything(); // Or inject some funny code to the stealer :P
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.