Domain Locking Your Game

There are some devious game sites out there that will host your Flash games without your permission. There are a few different methods available to help protect this from happening. The most basic protection is a domain lock, which effectively stops the game from running on servers other than the domain you specify.

Just include this actionscript in the first frame of your Flash movie:

    var myDomain="http://www.yourdomain.com";
    if(_url.substr(0, myDomain.length).toLowerCase()!=myDomain) {
        getURL(myDomain, "_parent");
        _root.gotoAndPlay("stolen");
    }

With this code in your movie if it is hosted on a domain other than ‘www.yourdomain.com’ the player will be redirected to your site and the movie playback will be moved to the frame ‘stolen’.

I’ll be posting a method for a stronger locking system soon.

Comments are closed.