Packagecom.milkmangames.nativeextensions.android
Classpublic class AdMob
InheritanceAdMob Inheritance Object

AdMob



Public Properties
 PropertyDefined By
  isSupported : Boolean
[static] [read-only] Returns true if the platform is Android supporting AdMob.
AdMob
Public Methods
 MethodDefined 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 ad.
AdMob
  
getTestDeviceIDs():Vector.<String>
[static] Get an array containing the Test Device ID for your current device; you can pass this to the showAd() function during testing.
AdMob
  
init(publisherId:String):void
[static] Initialize the AdMob interface.
AdMob
  
refreshAd():void
[static] Refresh the ad currently on display.
AdMob
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
[static] Removes a listener from the EventDispatcher object.
AdMob
  
setVisibility(visible:Boolean):void
[static] Sets the visibility of the current ad.
AdMob
  
showAd(type:String, horizontalAlign:String, verticalAlign:String, testDevices:Vector.<String> = null, offsetX:int = 0, offsetY:int = 0):void
[static] Displays a new Ad
AdMob
Events
 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 elsewhereAdMob
  Dispatched when ad has successfully loaded following a call to AdMob.showAd()AdMob
  Dispatched when a fullscreen interactive ad viewv is dismissed by the adAdMob
  Dispatched when a fullscreen interactive ad view is presented by an adAdMob
Public Constants
 ConstantDefined By
  VERSION : String = 1.0.6
[static] Current API Version
AdMob
Property Detail
isSupportedproperty
isSupported:Boolean  [read-only]

Returns true if the platform is Android supporting AdMob.


Implementation
    public static function get isSupported():Boolean
Method Detail
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.


Throws
Error — if AdMob.init has not been called

See also

destroyAd()method 
public static function destroyAd():void

Destroys the current ad. Throws an error if no ad is currently active.


Throws
Error — if AdMob.init has not been called
 
Error — if there is no current ad to destroy
getTestDeviceIDs()method 
public static function getTestDeviceIDs():Vector.<String>

Get an array containing the Test Device ID for your current device; you can pass this to the showAd() function during testing. Remember to remove it before publishing your application, so as not to display test ads to end users.

Returns
Vector.<String> — array containing current device's test ID

Throws
Error — if AdMob.init has not bee ncalled
init()method 
public static function init(publisherId:String):void

Initialize the AdMob interface. Call this once, before using any other methods.

Parameters

publisherId:String — your publisherId (check your AdMob account control panel for your App.)

refreshAd()method 
public static function refreshAd():void

Refresh the ad currently on display. Throws an error if no ad is currently active.


Throws
Error — if AdMob.init has not been called
 
Error — if there is no current ad to refresh
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.


Throws
Error — if AdMob.init has not been called

See also

setVisibility()method 
public static function setVisibility(visible:Boolean):void

Sets the visibility of the current 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.


Throws
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, testDevices:Vector.<String> = null, offsetX:int = 0, offsetY:int = 0):void

Displays a new Ad

Parameters

type:String — ad format, of the type AdMobAdType.BANNER,AdMobAdType.IAB_BANNER,AdMobAdType.IAB_LEADERBOARD, 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
 
testDevices:Vector.<String> (default = null) — (optional) Vector of device test IDs, if running test ads on device. (For convenience, you can pass AdMob.getTestDeviceIDs() to this parameter- but remember to remove it before publishing your app.) Alternatively, to get your devices test id, run an application and view logcat (command 'android-sdk\platform-tools\adb logcat'). Your device test ID will be printed there. See Google's AdMob documentation for more details.
 
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.


Throws
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, 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

Event Detail
FAILED_TO_RECEIVE_AD Event
Event Object Type: com.milkmangames.nativeextensions.android.events.AdMobErrorEvent
AdMobErrorEvent.type property = com.milkmangames.nativeextensions.android.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  
Event Object Type: com.milkmangames.nativeextensions.android.events.AdMobEvent
AdMobEvent.type property = com.milkmangames.nativeextensions.android.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 elsewhere
RECEIVED_AD Event  
Event Object Type: com.milkmangames.nativeextensions.android.events.AdMobEvent
AdMobEvent.type property = com.milkmangames.nativeextensions.android.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  
Event Object Type: com.milkmangames.nativeextensions.android.events.AdMobEvent
AdMobEvent.type property = com.milkmangames.nativeextensions.android.events.AdMobEvent.SCREEN_DISMISSED

Dispatched when a fullscreen interactive ad viewv is dismissed by the ad

Dispatched when a fullscreen interactive ad viewv is dismissed by the ad
SCREEN_PRESENTED Event  
Event Object Type: com.milkmangames.nativeextensions.android.events.AdMobEvent
AdMobEvent.type property = com.milkmangames.nativeextensions.android.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 ad
Constant Detail
VERSIONConstant
public static const VERSION:String = 1.0.6

Current API Version