Interstitial
Adobe Air Interstitial ad unit
Before you begin!
Make sure that you have completed the Adobe Air Plugin installation before you begin integrating the Interstitial ad unit
Integrating the Interstitial ad unit
Step 1: Import the ad unit
import com.appnext.ads.interstitial.Interstitial;
Step 2: Set the placement id
var interstitial_Ad:Interstitial = new Interstitial(ADD_HERE_YOUR_PLACEMENT_ID);
Step 3: Load the ad
You must load the ad before showing it.
interstitial_Ad.loadAd();
In case the loadAd function was not called, the SDK will return an error - "ad not ready".
Step 4: Show the ad
if (interstitial_Ad.isAdLoaded()){
interstitial_Ad.showAd();
}else{
//continue...
}
Step 5: Callbacks (optional)
In order to receive client-side events, import the following reference
import com.appnext.ads.events.AdEvent;
Receive events from the SDK:
Event for ad loaded
interstitial_Ad.addEventListener(AdEvent.AD_LOADED, adLoadedHandler);
function adLoadedHandler(event:AdEvent):void {
//process event here
}
Event for ad clicked
interstitial_Ad.addEventListener(AdEvent.AD_CLICKED, adClickedHandler);
function adClickedHandler(event:AdEvent):void {
//process event here
}
Event for ad closed
interstitial_Ad.addEventListener(AdEvent.AD_CLOSED, adClosedHandler);
function adClosedHandler(event:AdEvent):void {
//process event here
}
Event for ad error
interstitial_Ad.addEventListener(AdEvent.AD_ERROR, adErrorHandler);
function adErrorHandler(event:AdEvent):void {
//process event here
trace(event.message);
}
The following possible errors can be passed in the AdEvent.AD_ERROR handler:
NoInternetConnection;
NoPlacementID;
DownloadingResources;
AdNotReady;
PreparingViews;
LoadingAd;
NoAds;
FailedLoadingAds;
Example:
interstitial_Ad.addEventListener(AdEvent.AD_ERROR, adErrorHandler);
function adErrorHandler(event:AdEvent):void {
switch (event.message) {
case AppnextError.NoAds:
trace("no ads");
break;
case AppnextError.NoInternetConnection:
trace("connection problem");
break;
default:
trace("other error");
break;
}
Step 6: Configuring the Interstitial ad unit
By default, the SDK configuration will be loaded from Appnext's server. You can change the configuration directly by property or through the setter function.
Import the following class:
import com.appnext.ads.interstitial.InterstitialConfig;
Define the Interstitial configuration instance:
var config:InterstitialConfig = new InterstitialConfig();
List of configuration options:
Button Text (iOS only)
The install button's text (default is "Install")
Button Color (iOS only)
The install button's color - a 6 hex chars starting with # (default is "#6AB344")
Skip Button Text
Set a custom text for the "skip" button (default is "Skip)
Category
Set preferred ad categories
Install Postback
Postback parameters that will be posted to your server after user installed an app (make sure to encode the values)
Can Close (Android only)
"back" key can close the interstitial (default is "false")
true
false
Mute Video
Mute the video which is played in the Interstitial (default is "false")
true
false
Auto Play Video
Set video auto-play (default is "true")
true
false
Creative Type:
Set creative type for the main section of the Interstitial (default is "Interstitial.TYPE_MANAGED")
- Interstitial.TYPE_STATIC
- Interstitial.TYPE_VIDEO
- Interstitial.TYPE_MANAGED
Examples:
Interstitial config example:
var config:InterstitialConfig = new InterstitialConfig();
config.setButtonText("Install");
config.setButtonColor("#6AB344");
config.setSkipText("Skip");
config.setCategories("category1,category2");
config.setPostback("postback");
config.setBackButtonCanClose(false);
config.setAutoPlay(true);
config.setMute(false);
config.setCreativeType(Interstitial.TYPE_MANAGED);
// Or set the property directly:
config.buttonText = "Install";
config.buttonColor = "#6AB344";
config.skipText = "Skip";
config.categories = "category1,category2";
config.postback = "postback";
config.backButtonCanClose = false;
config.autoPlay = true;
config.mute = false;
config.creativeType = Interstitial.TYPE_MANAGED;
var interstitial_Ad:Interstitial = new Interstitial(placementID, config);
Use the setters
Interstitial interstitial_Ad = new Interstitial(this, placementID);
interstitial_Ad.setButtonText("Install");
interstitial_Ad.setButtonColor("#6AB344");
interstitial_Ad.setSkipText("Skip");
interstitial_Ad.setCategories("category1,category2");
interstitial_Ad.setPostback("postback");
interstitial_Ad.setBackButtonCanClose(false);
interstitial_Ad.setAutoPlay(true);
interstitial_Ad.setMute(false);
interstitial_Ad.setCreativeType("TYPE_MANAGED;");
App Categories
Android: 1. Action 2. Adventure 3. Arcade 4. Arcade & Action 5. Board 6. Books & Reference 7. Brain & Puzzle 8. Business 9. Card 10. Cards & Casino 11. Casino 12. Casual 13. Comics 14. Communications 15. Education 16. Educational 17. Entertainment 18. Family 19. Finance 20. Health & Fitness 21. Libraries & Demo 22. Lifestyle 23. Live Wallpaper 24. Media & Video 25. Medical 26. Music 27. Music & Audio 28. News & Magazines | 29. Personalization 30. Photography 31. Productivity 32. Puzzle 33. Racing 34. Role Playing 35. Shopping 36. Simulation 37. Social 38. Sports 39. Sports Games 40. Strategy 41. Tools 42. Travel & Local 43. Trivia 44. Weather 45. Word *iOS:** 1. Action 2. Adventure 3. Arcade 4. Board 5. Books 6. Business 7. Card 8. Casino 9. Catalogs 10. Dice | 11. Education 12. Educational 13. Entertainment 14. Family 15. Finance 16. Food & Drink 17. Graphics & Design 18. Health & Fitness 19. Kids 20. Lifestyle 21. Medical 22. Music 23. Navigation 24. News 25. Photo & Video 26. Productivity 27. Puzzle 28. Racing 29. Reference 30. Role Playing 31. Simulation 32. Social Networking 33. Sports 34. Strategy 35. Travel 36. Trivia 37. Utilities 38. Weather |
Integration Support
Should you have any problems integrating the product, log a ticket with us by emailing [email protected].
Updated almost 7 years ago