+31 (0) 20 760 2040 info@spilgames.com



The Flash plugin aims to make it easier to integrate GameAPI in Flash games. Please make sure that you meet the requirements.

  1. Include Game API files to your project
  2. Load the Game API
  3. Check for Site Lock if it is part of your contract with Spil
  4. Add Logo
  5. Add Promotional buttons (More games, App Store, Google Play, Facebook buttons)
  6. Implement Game Breaks
  7. Send scores to our back-end
  8. Grant awards to the players
  9. Test your integration


If you agreed with us to use our previous flash technology called Flash API please follow the documentation here.

IMPORTANT for testing!

For retrieving the correct configurations on the test tool, you need to add your GAME ID at the end of the test tool URL:

You will receive your GAME ID from your Spil Game Producer. For the following example the right URL would be: http://cdn.gameplayer.io/testtool/index.html#!/tester/576742227280291016

This way you make sure that your game will retrieve the correct configurations when you are testing.

1. Include Game API

DOWNLOAD the API file and unzip it. Then just include the folder to the source folder of your project as it is.

2. Load Game API

Load the API in the example.
ATTENTION: Make sure the API is loaded before you start using any other API call. To do that you will need to wait for the function onLoadComplete(e:Event) to be executed.

<p>import com.spilgames.gameapi.GameAPI;</p>
<p>var gameAPI:GameAPI = GameAPI.getInstance();</p>
<p>// once the COMPLETE event is dispatch by GameAPI you can make the calls<br /> gameAPI.addEventListener(Event.COMPLETE, onLoadComplete)</p>
<p>// pass a String containing the GAME ID you will receive from the game producer you are<br /> // in contact with and a reference to Flash's Stage<br /> gameAPI.loadAPI("576742227280291016", stage);</p>
<p>public function onLoadComplete(e:Event):void<br /> {<br /> // you can start using Spil Games GameAPI<br /> }</p>

3. Check for Site Lock

If your game is required to be site locked for Spil’s portals and partners you can use the isSiteLock call from the API in order to make the check.

The call will not lock the game, but return a Boolean value indicating if the game should be allowed to run or not. The call must be triggered after the API is loaded.

<p>import com.spilgames.gameapi.GameAPI;</p>
<p>var gameAPI:GameAPI = GameAPI.getInstance();</p>
<p>if (gameAPI.Game.isSiteLock())<br /> {<br /> // the game should be site locked and not run<br /> }</p>

4. Add Logo

Add the logo to your game after the API is loaded.

<br /> import com.spilgames.gameapi.GameAPI;<br /> import com.spilgames.gameapi.components.GameAPIBtn;<br /> import com.spilgames.gameapi.components.Logo;<br /> // the API logo Object extends Display Object and can be handled as such<br /> // it already has its click handler from GameAPI implemented<br /> var logo:Logo = GameAPI.getInstance().Branding.getLogo();<br /> logo.x = stage.width - 250;<br /> addChild(logo);<br />

5. Add Promotional Buttons

Promotional Buttons are buttons that the players can click and lead to the mobile app of the game or to offered more games or to other games of your game series. The table below sums up the possibilities. Of course you can create your own (Facebook,twitter) in coordination with your Spil Game Producer.

Shall I include it to my game?
Code tag
More games Yes more_games
App Store If the game is also on App Store app_store
Google Play If the game is also on Google Play google_play
My game 1 If your game is a part of a game series, make buttons to link to the rest of your games for example: Snail Bob 1, Snail Bob 2, Snail Bob 3 and so on Agree on the tag name together with your Game Producer

import com.spilgames.gameapi.GameAPI;
import com.spilgames.gameapi.components.GameAPIBtn;
import com.spilgames.gameapi.components.Logo;

//for more games button you have to create an image yourself
//when the button is pressed you can trigger with the call below

// if your game has promotional links set up in Spil Games backend with
// images configured, you can use the GameAPIBtn class just like the API logo
var appstore:Sprite = GameAPI.getInstance().Branding.getLink(“app_store”);
appstore.x = stage.width 250;
appstore.y = 100;

// if your game don’t have images for a promotional button set on Spil Games backend
// you can still trigger its action by calling it directly, similar to more games button


6. Game breaks request

During a natural pause in the game flow such as a level change you can add the GameBreak.request call. When a GameBreak is accepted from our side, we are able to pause the game and display external content such as in-game ad, game suggestions or walkthroughs. We make sure that users aren’t exposed to too much advertising and get the most relevant ads.

The call requires two arguments, a method to pause the game and another to resume it. This is in order to ensure that the game will not continue its flow if there is content displayed on top of it. Keep in mind that the resume method will always be called by the API where the pause will only be triggered if there is actual content to be displayed.

import com.spilgames.gameapi.GameAPI;

//Before calling the GameAPI.GameBreak.request method the API must be loaded and ready for use

// This method will be called only if there is content to be displayed on top of the game
private function pauseGame():void
// add here the logic to stop the game flow, sound and animations

// This method will always be called
private function resumeGame():void
// add here the logic to resume the game flow, sound and animations

if (GameAPI.getInstance().isReady)
GameAPI.getInstance().GameBreak.request(pauseGame, resumeGame);


7. Send Scores

You can submit the players Score by using the method below.

import com.spilgames.gameapi.GameAPI;

// make sure that GameAPI is initialised and ready
if (GameAPI.getInstance().isReady)


8. Grant Awards

In order to grant awards for a player in Spil Games’ network it is necessary to submit a tag for each award. The tags that are acceptable from Spil Games back-end are award1, award2, award3 and so on. The Spil game producer that you are in contact will make sure that these tags match your awards. The tag should be passed as a String parameter to the method call.

import com.spilgames.gameapi.GameAPI;

// make sure that GameAPI is initialised and ready
if (GameAPI.getInstance().isReady)
// Grant the first award of your game like the example below.

9. Testing your integration

Once you’ve finished implementing all the required features for your game you can test it on the TEST TOOL and remember to place your GAME ID at the end of the URL to get the correct configurations. Make sure that you meet our requirements before you send us your final build for QA.