Packagecom.myflashlab.air.extensions.admob
Classpublic class ApiBannerAds
InheritanceApiBannerAds Inheritance flash.events.EventDispatcher

This class lets you create a banner Ad and position it anywhere you like in your app.



Public Properties
 PropertyDefined By
  height : int
[read-only] Indicates the height of the banner Ad in pixels
ApiBannerAds
  visible : Boolean
Indicates the visibility of the banner Ad.
ApiBannerAds
  width : int
[read-only] Indicates the width of the banner Ad in pixels
ApiBannerAds
  x : int
Indicates the x position of the banner in your app in pixels
ApiBannerAds
  y : int
Indicates the y position of the banner in your app in pixels
ApiBannerAds
Public Methods
 MethodDefined By
  
dispose():void
Call this method to dispose the ad from your app.
ApiBannerAds
  
init($unitId:String, $adSize:int):void
Call this method to initialize a banner Ad in your app.
ApiBannerAds
  
loadAd($request:AdRequest):void
Call this method to start loading a new banner ad for you.
ApiBannerAds
  
setPosition($x:int, $y:int):void
Call this method and pass in the x,y position of the banner in pixels to position the banner anywhere you like to have it in your app UI.
ApiBannerAds
Public Constants
 ConstantDefined By
  ADAPTIVE_BANNER : int = 9
[static] Get adaptive ad size and return for setting on the ad view
ApiBannerAds
  BANNER : int = 1
[static] Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).
ApiBannerAds
  FULL_BANNER : int = 2
[static] Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).
ApiBannerAds
  LARGE_BANNER : int = 3
[static] Large banner ad size (320x100 density-independent pixels).
ApiBannerAds
  LEADERBOARD : int = 4
[static] Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).
ApiBannerAds
  MEDIUM_RECTANGLE : int = 5
[static] Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).
ApiBannerAds
  SMART_BANNER_LANDSCAPE : int = 8
[static] A dynamically sized banner that is full-width and auto-height.
ApiBannerAds
  SMART_BANNER_PORTRAIT : int = 7
[static] A dynamically sized banner that is full-width and auto-height.
ApiBannerAds
  WIDE_SKYSCRAPER : int = 6
[static] IAB wide skyscraper ad size (160x600 density-independent pixels).
ApiBannerAds
Property Detail
heightproperty
height:int  [read-only]

Indicates the height of the banner Ad in pixels


Implementation
    public function get height():int
visibleproperty 
visible:Boolean

Indicates the visibility of the banner Ad.


Implementation
    public function get visible():Boolean
    public function set visible(value:Boolean):void
widthproperty 
width:int  [read-only]

Indicates the width of the banner Ad in pixels


Implementation
    public function get width():int
xproperty 
x:int

Indicates the x position of the banner in your app in pixels


Implementation
    public function get x():int
    public function set x(value:int):void
yproperty 
y:int

Indicates the y position of the banner in your app in pixels


Implementation
    public function get y():int
    public function set y(value:int):void
Method Detail
dispose()method
public function dispose():void

Call this method to dispose the ad from your app. If you wish to show banner ads again, you need to call init() again.

If you need to temporarily hide the banner from the screen, it's best to set its visibility to false instead of disposing it!

See also

init()method 
public function init($unitId:String, $adSize:int):void

Call this method to initialize a banner Ad in your app. You can have only one instance of a banner ad in your page. But you can always initialize a new one which will automatically dispose the former one.

AdMob.api.banner.init("ca-app-pub-9222581623235742/6229120311", ApiBannerAds.BANNER);

Parameters

$unitId:String — For every app that you create in your Admob console, https://apps.admob.com/, you can create several ad units. Each unit will have a unique id which you should pass into your init method so the ANE can link the ad to your Admob account.
 
$adSize:int — Depending on the design of your app, you may like to show different banner sizes. You can pick one from the constants available in this class. NOTE: if you are creating a banner ad which is too large for your screen, the ad may not be shown at all! so maybe using the smart ad size banners are the best.

loadAd()method 
public function loadAd($request:AdRequest):void

Call this method to start loading a new banner ad for you. If you need to know if the banner has been loaded successfully or not, you should listen to the AdMobEvents events.

For banner Ads, the best time to set the location of the banner in your app is when AdMobEvents.AD_LOADED happens.

Parameters

$request:AdRequest

See also

com.myflashlab.air.extensions.admob.events.AdMobEvents
setPosition()method 
public function setPosition($x:int, $y:int):void

Call this method and pass in the x,y position of the banner in pixels to position the banner anywhere you like to have it in your app UI.

Parameters

$x:int
 
$y:int

Constant Detail
ADAPTIVE_BANNERConstant
public static const ADAPTIVE_BANNER:int = 9

Get adaptive ad size and return for setting on the ad view

BANNERConstant 
public static const BANNER:int = 1

Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).

FULL_BANNERConstant 
public static const FULL_BANNER:int = 2

Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).

LARGE_BANNERConstant 
public static const LARGE_BANNER:int = 3

Large banner ad size (320x100 density-independent pixels).

LEADERBOARDConstant 
public static const LEADERBOARD:int = 4

Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).

MEDIUM_RECTANGLEConstant 
public static const MEDIUM_RECTANGLE:int = 5

Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).

SMART_BANNER_LANDSCAPEConstant 
public static const SMART_BANNER_LANDSCAPE:int = 8

A dynamically sized banner that is full-width and auto-height.

SMART_BANNER_PORTRAITConstant 
public static const SMART_BANNER_PORTRAIT:int = 7

A dynamically sized banner that is full-width and auto-height.

WIDE_SKYSCRAPERConstant 
public static const WIDE_SKYSCRAPER:int = 6

IAB wide skyscraper ad size (160x600 density-independent pixels). This size is currently not supported by the Google Mobile Ads network; this is intended for mediation ad networks only.