Monetizing flash games: Improve your revenue with site specific features

By checking the domain your game is played on you can provide the player with certain features which then make your game exclusive to a site. How about adding a ‘BloodMode’ (in a way that is unsuitable for Mochi) when played on Kong or AG?

All you need to check is the current domain. So, that could be some appropriate code:

var domain:Array = loaderInfo.url.split("://");
var base_domain:Array = domain[1].split(".");
if ( base_domain[1].toString() == "kongregate" ){
 showCustomLoaderBar();
 //insert kongAPI
}
else if ( base_domain[0].toString() == "armorgames" ){
 showCustomLoaderBar();
 // insert agAPI
}
else {
 //mochi
 gotoAndStop(3);
 var newClass = getDefinitionByName("DocumentClass") as Class;
 documentClass = new newClass(stage);
 stage.addChild(documentClass);
}

Line 1 gets the URL string, and stores all parts that are split by :// in an Array. In the normal environment this would be http and the complete domain.
Line 2 splits the URL by dots, thus you may get www, domainname, extension/rest/of/theURL.example.
Lines 3, 7 and 11 check wether you are on Kong, AG or anywhere else. Put in the statements you need. Maybe you want your own domain providing the extra crunchy special features (don’t forget to tell the player ingame). Not all domains come with the www part, so be sure what to check here.
Depending on what is true your SWF shows either Mochi (in the else statement beacuse of the wide distribution) or your custom preloader.

This example shows loaderInfo.url:String, then what would be the result of split(“://”), the complete Array split by dots, and the test if the domain contains “natan” (yes, you can also use this for sitelocking purposes.

Set sail to income coast! Yo ho!

This entry was posted in game development, mochiads, monetization and tagged , , , , , , , , . Bookmark the permalink.
Be Sociable, Share!

Leave a Reply

Your email address will not be published.