1

Add a New Game:

This document describes how to integrate the Flash In-Game Ad Integrator library into your games. To see an example of the Ad Integrator in action, check out this demo game. You can also view our standalone demo and download the source code here.
  • First, you need to create a record of your game in our systems. Log in to http://app.intergi.com , select “Add or Resume Game” from the Games option in the top navigation, then click on the “Add New Game” button in the top right corner.
  • Complete the first three steps of adding a new game. You will then reach Step 4, where you will receive your Game ID and Publisher ID. Note them down; you will need them to get ads running in your game.
2

Include AdIntegrator.swc:

  • The only library you need to include in your game is AdIntegrator.swc. Click here to download the Ad Integrator library.
  • Open your ActionScript 3.0 settings. Select the Library panel and add AdIntegrator.swc. Make sure its linkage is set to ‘Merge into code’
3

Create and Initialize AdIntegrator instance:

  • First, import the com.playwire.integrator package (AdIntegrator.swc) that you downloaded and linked in the previous step.
import com.playwire.integrator.*;
  • Next, create an instance of AdIntegrator and initialize it with the Game ID and Publisher ID assigned to your game in Step 4 of the Add New Game process.
  • Your Publisher ID is the number in the URL shown (e.g., it would be ‘118’ in the URL provided in the example).
_adIntegrator = new AdIntegrator();
_adIntegrator.initialize('yourpublisherId','yourgameId',this.stage);
Event type Dispatched when …
AdIntegratorEvent.CONTENT_PAUSE_REQUESTED an ad is about to be loaded
AdIntegratorEvent.CONTENT_RESUME_REQUESTED ad is complete or an error occurs
_adIntegrator.addEventListener(AdIntegratorEvent.CONTENT_PAUSE_REQUESTED, onContentPauseRequested); _adIntegrator.addEventListener(AdIntegratorEvent.CONTENT_RESUME_REQUESTED, onContentResumeRequested);
private function onContentResumeRequested(event:Event):void { 
	trace(this,event.type); //resume your game 
}
private function onContentPauseRequested(event:Event):void {
	trace(this, event.type); //pause your game
}
  • There are also additional events that you can listen for debugging and, perhaps, your own logging or analytics.
Event type Dispatched when …
AdIntegratorEvent.AD_START ad starts playing
AdIntegratorEvent.AD_COMPLETE ad is complete
AdIntegratorEvent.AD_CLICKED ad is clicked
AdIntegratorErrorEvent.ERROR error occurs
4

Request Ads:

This document describes how to integrate the Flash In-Game Ad Integrator library into your games. To see an example of the Ad Integrator in action, check out this sample game.
_adIntegrator.showAd();
  • Pause your game when the integrator dispatches the CONTENT_PAUSE_REQUESTED event and resume it later on CONTENT_RESUME_REQUESTED event.
  • Please note that your game must be fully uploaded to http://app.intergi.com and approved before it will receive ads to play! You’ll want to finish the upload process now.
5

Last Steps:

Return to http://app.intergi.com and finish adding your game to the system. If you closed your browser window, you can resume the process by logging in again and clicking the “Resume” button in the top right. Proceed through the final steps of game upload. You are done!

Destroy AdIntegrator and Free Memory

If you don’t want to show ads anymore, you can permanently destroy the integrator to free memory by calling its destroy() method, remove all of its event listeners, and nullify its reference. Note that once you destroy the integrator, you will not be able to show ads again even if you create a new integrator instance.
//1. destroy the integrator
_adIntegrator.destroy();
//2. remove all event listeners
//3. null it _adIntegrator = null;

Debugging

If you don’t want to show ads anymore, you can permanently destroy the integrator to free memory by calling its destroy() method, remove all of its event listeners, and nullify its reference. Note that once you destroy the integrator, you will not be able to show ads again even if you create a new integrator instance.
private function onAdIntegratorError(event:AdIntegratorErrorEvent):void {
	trace(this,event.type,event.message,event.info);
}
If you don’t see an ad and yet the ERROR event is not dispatched, it means the integrator is not receiving any ads to display. Please note that this does not necessarily mean something is wrong in your game or the integrator itself as it is not uncommon for ad servers, at some point, not to deliver anything. However, if you don’t see ads at all for an extended period of time, please don’t hesitate to contact us for help.

Embed Game During Testing

The integrator requires access to JavaScript in order to read the site domain and request ads properly. For that reason, it must be embedded on an html page and loaded in a web server during testing. Be sure to embed your game with allowScriptAccess=”always”.

We value your feedback, please let us know how we are doing:

  • Was this support article helpful ?
  • Yes   No