Use Keymob in actionscript3admin To Published in 2015-07-09 flash air( Read:3708

Use Keymob in actionscript3 

 a.add import

import com.keymob.*;
Before using keymob, first import keymob related class files. Most of the core classes in com.keymob package, so you can import all at once. KeymobAd is the main class of keymob.
  
 b.Setup and initialize keymob
init Keymob from JSON config file.
KeymobAd.getInstance().initFromJSON(jsonString);

  The  parameter is the config info of each platform in json string format,json format reference template.

  or init Keymob from www.keymob.com

KeymobAd.getInstance().initFromKeymobService("1");

the parameter is app id got from www.keymob.com.


 c. Display banner advertising
KeymobAd.getInstance().showRelationBanner(AdSizes.BANNER,AdPositions.BOTTOM_CENTER,10);
The above means that displays the standard banner ad at the bottom of the device . The first parameter is the ad size, the type size can be selected in AdSizes constants, including the standard banner, rectange banner, smart banner and so on.
  Other banner size outside  standard size(320*50) may have  small differences in the different platforms, run to see the effects.
  The second parameter is the position of the banner displayed,  the value of each position is  in AdPositions constants,including the top left, top center, top right-hand and so on ,9 kinds of common position total.
  The third parameter is padding Y, i.e., the relative positional deviation, e.g., on the bottom of the application, the upward offset 80 pixels, that is, the effect of the above code. If you want to stick to the bottom of the application, set the padding Y 0.
 
 d. display banner at Fixed location
KeymobAd.getInstance().showBannerABS(AdSizes.BANNER, 0, 200);
The above code is display standard banner at point(0,200)
     Although the relative positioning to meet the needs of the majority of advertising location settings, but to meet the needs of some special position, keymob provides absolute fixed position display banner advertising api.
     The first parameter is the size of the banner, the second argument and third parameters are the position x and y values of banner.

 e. Hide banne ad
KeymobAd.getInstance().removeBanner();
   "removeBanner" hidden banner advertising, but advertising will not be destroyed so show can be quickly presented to the user next time. Some advertising platform will continue to  load ad after hidden , so the event will dispatched also.

f. Load and display Interstitial ads     

KeymobAd.getInstance().loadInterstitial();


   Load Interstitial ads, does not automatically show after load successfully, this can better control Interstitial ad at the right time to show to the user,
    If you want to show immediate after load,just handler onLoadedSuccess  in eventListener and call showInterstitial.
KeymobAd.getInstance().showInterstitial();
   Display Interstitial advertising, ads will appear immediately after the call showInterstitial. However, please ensure that advertising has finished loading.
KeymobAd.getInstance().isInterstitialReady();
   Check the Interstitial ad is loaded complete. If call showInterstitial directly when an ad  has not finished loading unpredictable events will occur, som advertising platform could lead to crash.
    So make sure the Interstitial is ready before every show.Below is the overall look.
if(KeymobAd.getInstance().isInterstitialReady()){
KeymobAd.getInstance().showInterstitial();
}

g. Load and display video ads

KeymobAd.getInstance().loadVideo();

  Load video ads, does not automatically show after load successfully, this can better control video ad at the right time to show to the user,

    If you want to show immediate after load,just handler onLoadedSuccess  in eventListener and call showVideo.
KeymobAd.getInstance().showVideo();
   Display video ads, ads will appear immediately after the call showVideo. However, please ensure that advertising has finished loading.
KeymobAd.getInstance().isVideoReady();
  Check the video ad is loaded complete. If call showVideo directly when an ad  has not finished loading unpredictable events will occur, some advertising platform could lead to crash.

    So make sure the video is ready before every show.Below is the overall look.

   	if(KeymobAd.getInstance().isVideoReady()){
         KeymobAd.getInstance().showVideo();
        }
 h. Application load and display more app advertising


KeymobAd.getInstance().loadAppWall();


   Load more app ads, does not automatically show after load successfully, this can better control video ad at the right time to show to the user,

    If you want to show immediate after load,just handler onLoadedSuccess  in eventListener and call showAppWall.

KeymobAd.getInstance().showAppWall();
   Display more app ads, ads will appear immediately after the call showAppWall. However, please ensure that advertising has finished loading.
   Check the More App ad is loaded complete. If call showAppWall directly when an ad  has not finished loading unpredictable events will occur, some advertising platform could lead to crash.
    So make sure the More App is ready before every show.Below is the overall look.
if(KeymobAd.getInstance().isAppWallReady()){
KeymobAd.getInstance().showAppWall();
}

0 Reviews,0 Participation.

Previous Next 0

Latest comments

No comment Oh!