Package | com.myflashlab.air.extensions.admob |
Class | public class ApiBannerAds |
Inheritance | ApiBannerAds flash.events.EventDispatcher |
Property | Defined 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 |
Method | Defined 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 | ||
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 |
Constant | Defined 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 |
height | property |
height:int
[read-only] Indicates the height of the banner Ad in pixels
public function get height():int
visible | property |
visible:Boolean
Indicates the visibility of the banner Ad.
public function get visible():Boolean
public function set visible(value:Boolean):void
width | property |
width:int
[read-only] Indicates the width of the banner Ad in pixels
public function get width():int
x | property |
x:int
Indicates the x position of the banner in your app in pixels
public function get x():int
public function set x(value:int):void
y | property |
y:int
Indicates the y position of the banner in your app in pixels
public function get y():int
public function set y(value:int):void
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
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 |
ADAPTIVE_BANNER | Constant |
public static const ADAPTIVE_BANNER:int = 9
Get adaptive ad size and return for setting on the ad view
BANNER | Constant |
public static const BANNER:int = 1
Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).
FULL_BANNER | Constant |
public static const FULL_BANNER:int = 2
Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).
LARGE_BANNER | Constant |
public static const LARGE_BANNER:int = 3
Large banner ad size (320x100 density-independent pixels).
LEADERBOARD | Constant |
public static const LEADERBOARD:int = 4
Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).
MEDIUM_RECTANGLE | Constant |
public static const MEDIUM_RECTANGLE:int = 5
Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).
SMART_BANNER_LANDSCAPE | Constant |
public static const SMART_BANNER_LANDSCAPE:int = 8
A dynamically sized banner that is full-width and auto-height.
SMART_BANNER_PORTRAIT | Constant |
public static const SMART_BANNER_PORTRAIT:int = 7
A dynamically sized banner that is full-width and auto-height.
WIDE_SKYSCRAPER | Constant |
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.