Get the full commented source code of

HTML5 Suika Watermelon Game

Talking about Actionscript 3, Flash, Game development and Monetize.

Just to confirm Flash gaming market has still a lot to say, let me introduce a new way to make money with your Flash games: FGL Ads.

FGL aka FlashGameLicense is a great player in Flash game development industry, most of my games found sponsors thanks to FGL so I was so excited to try its own ad service I made a little game just to test them.

FLG Ads seems to be a great way to generate more revenue with your game, they promise an above-average CPM and a very simple way to place ads in your game.

While I am not able to confirm the CPM yet, I can confirm these ads are one of the most easy API to use.

Let’s see a real-life example: once we are registered with FGL, we can create a new Ad Token. An Ad Token is the identifier of the game we are going to publish.

Now the game is created and we can see it in the dashboard:

Next step is download FGLAds class and add it to your project root.

In my game, I wanted the ad to be displayed before the game starts and at the end of the game, so it will look like something like that:

package {
	import flash.display.Sprite;
	...

	public class Main extends Sprite {
		// variable declaration
		private var ads:FGLAds;
		...
		public function Main() {
			// FGL-56 is my game ID
			ads=new FGLAds(stage,"FGL-56");
			// waiting for the api to be ready to call showStartupAd
			ads.addEventListener(FGLAds.EVT_API_READY, showStartupAd);
			// should it take too long to load, let's skip the ad and call enableGame function
			ads.addEventListener(FGLAds.EVT_AD_LOADING_ERROR, enableGame);
		}

		private function showStartupAd(e:Event):void {
			// showing ad popup
			ads.showAdPopup();
			// waiting for the player to close the popup
			ads.addEventListener(FGLAds.EVT_AD_CLOSED, enableGame);
		}

		private function enableGame(e:Event):void {
			// removing listeners
			ads.removeEventListener(FGLAds.EVT_AD_CLOSED, enableGame);
			ads.removeEventListener(FGLAds.EVT_AD_LOADING_ERROR, enableGame);
			// start the game
			init();
		}
		
		private function init():void{
			// here starts the game, which calls showGameOver function when the game is over
			...
		}
		
		private function showGameOver():void{
			// no need to construct again, just calling showAdPopup method
			ads.showAdPopup();
		}
	}
}

showAdPopup method has three optional arguments:

format:String – the format of the ad to request, can be FORMAT_300x250 (default) or FORMAT_90x90.

delay:Number – amount of milliseconds needed (default:3000) before an ad can be closed

timeout:Number – amount of milliseconds needed (default:0 – never) before an ad closes by itself.

And here is how an ad looks like (a bit scaled down):

I am going to release the game later this week to test ads performances. The report screen is not live yet because the service is brand new, and just like all brand new services, the first to jump in usually get the most out of it, so you should definitively give it a try.

Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.