Flash air display plaque advertising tutorial
The preparation for coding
Before reading this tutorial, please read getting started with flash ad to learn how to get library, how to install library, how configuration platform
Add advertising related as3 code
1.Import keymob related classes
import com.keymob.*;
2. Initialization Keymob
Initialization Keymob library management is the prerequisite to call other advertising functions, the following initialization method is to use the Keymob.com service
KeymobAd.getInstance().initFromKeymobService("1",false);
Parameter Description
- "1" the first parameter is the app ID got from Keymob.com
- "false" Whether testing mode, set to true when debug, set false when released
3.loading ads
KeymobAd.getInstance().loadInterstitial();
4.Check whether Interstitial is load successfully
KeymobAd.getInstance().isInterstitialReady();
5. display Interstitial
KeymobAd.getInstance().showInterstitial();
6. Show Interstitial Appropriately
Check whether ad is load successfully is a good practice
if(KeymobAd.getInstance().isInterstitialReady()){
KeymobAd.getInstance().showInterstitial();
}
Monitor advertising events
In Interstitial advertising can show at the end of the game or show it manual ,or can be shown when loaded
KeymobAd.getInstance().addEventListener(AdEvent.ON_LOADED_SUCCESS,onLoadSuccess);
protected function onLoadSuccess(event:AdEvent):void
{
if(event.adtype==AdTypes.INTERSTITIAL){
KeymobAd.getInstance().showInterstitial();
}
}
}
Configuration changes
After writing the code, in accordance with the previous tutorial , add permissions configuration and Activity configuration information
More tutorial of add ad in app qq group 310513042 home