Property | Defined By | ||
---|---|---|---|
isSupported : Boolean [static] [read-only]
Returns true if the platform is a mobile phone supporting AdMob. | AdMob |
Method | Defined By | ||
---|---|---|---|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void [static]
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | AdMob | ||
destroyAd():void [static]
Destroys the current banner ad. | AdMob | ||
enableTestDeviceIDs(testDevices:Vector.<String>):void [static]
Sets a list of device IDs, for which test ads will always display. | AdMob | ||
getCurrentTestDeviceIDs(additionalIDs:Array = null):Vector.<String> [static]
Get an array containing the Test Device ID for your current device; you can pass this to the enableTestDeviceIDs() function during testing. | AdMob | ||
init(publisherId:String, secondPublisherId:String = null):void [static]
Initialize the AdMob interface. | AdMob | ||
isInterstitialReady():Boolean [static]
Checks whether an interstitial ad being preloaded with a prior call to loadInterstitial() is loaded and ready for display. | AdMob | ||
loadInterstitial(adUnitID:String, autoShow:Boolean = true, secondAdUnitID:String = null):void [static]
Loads an interstitial ad. | AdMob | ||
loadSystemAdvertisingId():void [static]
Load the System Advertising ID. | AdMob | ||
refreshAd():void [static]
Refresh the banner ad currently on display. | AdMob | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void [static]
Removes a listener from the EventDispatcher object. | AdMob | ||
setBannerAdUnitID(adUnitID:String, secondAdUnitID:String = null):void [static]
Sets the Ad Unit ID that will be used for banner ads. | AdMob | ||
setChildDirected(isChildDirected:Boolean = false):void [static]
To comply with COPPA, call setChildDirected(true) if your application is targeting children. | AdMob | ||
setVisibility(visible:Boolean):void [static]
Sets the visibility of the current banner ad. | AdMob | ||
showAd(type:String, horizontalAlign:String, verticalAlign:String, offsetX:int = 0, offsetY:int = 0):void [static]
Displays a new Banner Ad. | AdMob | ||
showPendingInterstitial():void [static]
Displays an interstitial ad that was previously preloaded with loadInterstitial(). | AdMob | ||
trackIOSConversion(conversionID:String, label:String, value:String):void [static]
Tracks an install conversion for iOS. | AdMob |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when ad has failed to load after a call to showAd() | AdMob | |||
Dispatched when a user action on an ad causes the focus to change elsewhere | AdMob | |||
Dispatched when ad has successfully loaded following a call to AdMob.showAd() | AdMob | |||
Dispatched when a fullscreen interactive ad view is dismissed by the ad | AdMob | |||
Dispatched when a fullscreen interactive ad view is presented by an ad | AdMob | |||
Dispatched in response to AdMob.loadSystemAdvertisingId() | AdMob |
Constant | Defined By | ||
---|---|---|---|
VERSION : String = 4.6.0 [static]
Current API Version
| AdMob |
isSupported | property |
isSupported:Boolean
[read-only] Returns true if the platform is a mobile phone supporting AdMob. (Android, iOS, or both, depending on the extension version.)
public static function get isSupported():Boolean
addEventListener | () | method |
public static function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
Parameters
type:String — event type (AdMobEvent or AdMobErrorEvent)
| |
listener:Function — The listener function that processes the event.
| |
useCapture:Boolean (default = false ) — Determines whether the listener works in the capture phase or the target and bubbling phases.
| |
priority:int (default = 0 ) — The priority level of the event listener. Priorities are designated by a 32-bit integer.
| |
useWeakReference:Boolean (default = false ) — Determines whether the reference to the listener is strong or weak.
|
Error — if AdMob.init has not been called
|
See also
destroyAd | () | method |
public static function destroyAd():void
Destroys the current banner ad. Throws an error if no ad is currently active.
Error — if AdMob.init has not been called
|
enableTestDeviceIDs | () | method |
public static function enableTestDeviceIDs(testDevices:Vector.<String>):void
Sets a list of device IDs, for which test ads will always display. You can get the current device's ID by calling getCurrentTestDeviceIDs(). Remember to remove the enableTestDeviceIDs() call before publishing your application, so as not to display test ads to end users.
Parameters
testDevices:Vector.<String> — (optional) Vector of device test IDs, if running test ads on device. (For convenience, you can pass AdMob.getCurrentTestDeviceIDs() to this parameter- but remember to remove it before publishing your app.) Alternatively, to get your devices test id on Android, run an application and view logcat (command 'android-sdk\platform-tools\adb logcat'). Your device test ID will be printed there. For iOS, you can just enter 'TEST'. See Google's AdMob documentation for more details.
|
Error — if AdMob.init has not been called
|
getCurrentTestDeviceIDs | () | method |
public static function getCurrentTestDeviceIDs(additionalIDs:Array = null):Vector.<String>
Get an array containing the Test Device ID for your current device; you can pass this to the enableTestDeviceIDs() function during testing. Remember to remove the enableTestDeviceIDs() call before publishing your application, so as not to display test ads to end users.
Parameters
additionalIDs:Array (default = null ) — array of additional Strings to append to the test IDs list.
|
Vector.<String> — array containing current device's test ID
|
Error — if AdMob.init has not been called
|
init | () | method |
public static function init(publisherId:String, secondPublisherId:String = null):void
Initialize the AdMob interface. Call this once, before using any other methods.
Parameters
publisherId:String — your publisherId or Ad Unit ID to use for banner ads (check your AdMob account control panel for your App.)
| |
secondPublisherId:String (default = null ) — if publishing for both iOS and Android, and supported by this version of the extension, set the publisherId param to the Android ID and the second parameter to the iOS ID. If publishing for only one platform, fill only fiirst parameter with the appropriate ID.
|
isInterstitialReady | () | method |
public static function isInterstitialReady():Boolean
Checks whether an interstitial ad being preloaded with a prior call to loadInterstitial() is loaded and ready for display.
ReturnsBoolean — true if an interstitial is ready for display via showPendingInterstitial().
|
Error — if AdMob.init has not been called
|
loadInterstitial | () | method |
public static function loadInterstitial(adUnitID:String, autoShow:Boolean = true, secondAdUnitID:String = null):void
Loads an interstitial ad. By default, the ad will be displayed automatically when the ad has been loaded. To preload the ad for later use, set the autoShow parameter to false, and call showPendingInterstitial() after receiving the AdMobEvent.RECEIVED_AD callback (it's isInterstitial property will be set to 'true'). Note that you can only load (or preload) one interstitial at a time. Before loading the next interstitial, you must wait for the original interstitial to be removed, either due to a FAILED_TO_RECIEVE_AD or SCREEN_DISMISSED event. If you are targeting both Android and iOS from the same code base, and you wish to use different ad unit IDs for the two platforms, set the Android ad unit ID as the first parameter, and the iOS ad unit ID as the third parameter.
Parameters
adUnitID:String — the ad unit ID of the interstitial to display
| |
autoShow:Boolean (default = true ) — (optional) if set to false, the ad will preload but not be displayed until showPendingInterstitial() is called.
| |
secondAdUnitID:String (default = null ) — (optional) if targeting both iOS and Android, set this to the iOS ID, and the first parameter to the Android ID.
|
Error — if AdMob.init has not been called
| |
Error — if the previous interstitial has not yet completed
|
loadSystemAdvertisingId | () | method |
public static function loadSystemAdvertisingId():void
Load the System Advertising ID. On Android systems, this is the Google Advertising Identifier. On iOS Systems, this is the Identifier for Advertising. When complete, AdMobEvent.SYSTEM_AD_ID_LOADED
will be dispatched; If the user has opted out of this type of tracking, its systemAdvertisingId
property will be the string "limited". If the ID is not available on this OS, it will be null.
See also
refreshAd | () | method |
public static function refreshAd():void
Refresh the banner ad currently on display.
Error — if AdMob.init has not been called
|
removeEventListener | () | method |
public static function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.
Parameters
type:String — event type (AdMobEvent or AdMobErrorEvent)
| |
listener:Function — The listener function that processes the event.
| |
useCapture:Boolean (default = false ) — Determines whether the listener works in the capture phase or the target and bubbling phases.
|
Error — if AdMob.init has not been called
|
See also
setBannerAdUnitID | () | method |
public static function setBannerAdUnitID(adUnitID:String, secondAdUnitID:String = null):void
Sets the Ad Unit ID that will be used for banner ads. If you are targeting both Android and iOS from the same code base, and you wish to use different ad unit IDs for the two platforms, set the Android ad unit ID as the first parameter, and the iOS ad unit ID as the second parameter.
Parameters
adUnitID:String — ad unit ID to use when displaying banner ads
| |
secondAdUnitID:String (default = null ) — (optional) if targeting both iOS and Android, set this to the iOS ID, and the first parameter to the Android ID.
|
Error — if AdMob.init has not been called
|
setChildDirected | () | method |
public static function setChildDirected(isChildDirected:Boolean = false):void
To comply with COPPA, call setChildDirected(true) if your application is targeting children.
Parameters
isChildDirected:Boolean (default = false ) — whether the app may be serving ads to children
|
Error — if AdMob.init has not been called
|
setVisibility | () | method |
public static function setVisibility(visible:Boolean):void
Sets the visibility of the current banner ad. It may be useful to hide and show an ad instead of destroying and reloading.
Parameters
visible:Boolean — true or false - whether the ad is visible or not.
|
Error — Thrown if AdMob.init has not yet been called first
| |
Error — Thrown if there is no activeAd to show or hide.
|
showAd | () | method |
public static function showAd(type:String, horizontalAlign:String, verticalAlign:String, offsetX:int = 0, offsetY:int = 0):void
Displays a new Banner Ad. You can set the ad unit id for banner ads by calling setBannerAdUnitID().
Parameters
type:String — ad format, of the type AdMobAdType.BANNER,AdMobAdType.IAB_BANNER,AdMobAdType.IAB_LEADERBOARD, AdMobAdType.SMART_BANNER or AdMobAdType.IAB_MRECT. See AdMob documentation for more information.
| |
horizontalAlign:String — horizontal alignment of the ad of the type AdMobAlignment.LEFT,AdMobAlignment.RIGHT, or AdMobAlignment.CENTER
| |
verticalAlign:String — vertical alignment of the ad of the type AdMobAlignment.TOP,AdMobAlignment.BOTTOM,AdMobAlignment.CENTER
| |
offsetX:int (default = 0 ) — (optional) set an exact X pixel offset (for absolute positioning.) Note that this is relative to the actual screen height, not any fullscreen scaling; if your screen is scaled, you'll need to calculate the correct relative coordinates. for basic absolute positioning (traditional x, y from top left), use AdMobAlignment.TOP and AdMobAlignment.LEFT for horizontalAlign and verticalAlign respectively.
| |
offsetY:int (default = 0 ) — (optional) set an exact Y pixel offset (for absolute positioning.) Note that this is relative to the actual screen height, not any fullscreen scaling; if your screen is scaled, you'll need to calculate the correct relative coordinates. for basic absolute positioning (traditional x, y from top left), use AdMobAlignment.TOP and AdMobAlignment.LEFT for horizontalAlign and verticalAlign respectively.
|
Error — Thrown if AdMob.init has not yet been called first
| |
Error — if adFormat is not one of the valid types AdMobAdType.BANNER,AdMobAdType.IAB_BANNER,AdMobAdType.IAB_LEADERBOARD, AdMobAdType.SMART_BANNER or AdMobAdType.IAB_MRECT
| |
ArgumentError — if horizontalAlign is not one of the valid types AdMobAlignment.LEFT,AdMobAlignment.RIGHT, or AdMobAlignment.CENTER
| |
ArgumentError — if verticalAlign is not one of the valid types AdMobAlignment.TOP,AdMobAlignment.BOTTOM,AdMobAlignment.CENTER
|
See also
showPendingInterstitial | () | method |
public static function showPendingInterstitial():void
Displays an interstitial ad that was previously preloaded with loadInterstitial(). The ad will only be displayed if preloading is completed, and the AdMobEvent.RECEIVED_AD event has been dispatched with its isInterstitial property true. You can directly check if an interstitial is ready to display with the AdMob.isInterstitialReady() function.
Error — if AdMob.init has not been called
|
trackIOSConversion | () | method |
public static function trackIOSConversion(conversionID:String, label:String, value:String):void
Tracks an install conversion for iOS. Does nothing on Android, as this happens automatically there.
Parameters
conversionID:String — conversion ID
| |
label:String — conversion label
| |
value:String — conversion label
|
FAILED_TO_RECEIVE_AD | Event |
com.milkmangames.nativeextensions.events.AdMobErrorEvent
com.milkmangames.nativeextensions.events.AdMobErrorEvent.FAILED_TO_RECEIVE_AD
Dispatched when ad has failed to load after a call to showAd()
Dispatched when ad has failed to load after a call to showAd()LEAVE_APPLICATION | Event |
com.milkmangames.nativeextensions.events.AdMobEvent
com.milkmangames.nativeextensions.events.AdMobEvent.LEAVE_APPLICATION
Dispatched when a user action on an ad causes the focus to change elsewhere
Dispatched when a user action on an ad causes the focus to change elsewhereRECEIVED_AD | Event |
com.milkmangames.nativeextensions.events.AdMobEvent
com.milkmangames.nativeextensions.events.AdMobEvent.RECEIVED_AD
Dispatched when ad has successfully loaded following a call to AdMob.showAd()
Dispatched when ad has successfully loaded following a call to AdMob.showAd()SCREEN_DISMISSED | Event |
com.milkmangames.nativeextensions.events.AdMobEvent
com.milkmangames.nativeextensions.events.AdMobEvent.SCREEN_DISMISSED
Dispatched when a fullscreen interactive ad view is dismissed by the ad
Dispatched when a fullscreen interactive ad view is dismissed by the adSCREEN_PRESENTED | Event |
com.milkmangames.nativeextensions.events.AdMobEvent
com.milkmangames.nativeextensions.events.AdMobEvent.SCREEN_PRESENTED
Dispatched when a fullscreen interactive ad view is presented by an ad
Dispatched when a fullscreen interactive ad view is presented by an adSYSTEM_AD_ID_LOADED | Event |
com.milkmangames.nativeextensions.android.events.AdMobEvent
com.milkmangames.nativeextensions.android.events.AdMobEvent.SYSTEM_AD_ID_LOADED
Dispatched in response to AdMob.loadSystemAdvertisingId()
VERSION | Constant |
public static const VERSION:String = 4.6.0
Current API Version