Flash application display banner ads in the relative position
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. Display advertising
Show banner ads in the relative position location at the center bottom of the app
KeymobAd.getInstance().showRelationBanner(AdSizes.BANNER,AdPositions.BOTTOM_CENTER,0);
Parameters
Description
- AdSizes.BANNER the first parameter size, all the support banner sizes in AdSizes
class .
- AdPositions BOTTOM_CENTER the second parameter is the relative position of advertising
- " 0" the third parameter is the padding y
Configuration changes
After writing the code, in accordance with the previous tutorial
, add permissions configuration and Activity configuration
More tutorial of add ad in app qq group 310513042 home