Last active
August 29, 2015 13:57
-
-
Save marchbold/9760829 to your computer and use it in GitHub Desktop.
Adverts ANE example for initialisation, and basic usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
Adverts.init( DEV_KEY ); | |
if (Adverts.isSupported) | |
{ | |
Adverts.service.addEventListener( AdvertEvent.RECEIVED_AD, adverts_receivedAdHandler, false, 0, true ); | |
Adverts.service.addEventListener( AdvertEvent.ERROR, adverts_errorHandler, false, 0, true ); | |
Adverts.service.addEventListener( AdvertEvent.USER_EVENT_DISMISSED, adverts_userDismissedHandler, false, 0, true ); | |
Adverts.service.addEventListener( AdvertEvent.USER_EVENT_LEAVE, adverts_userLeaveHandler, false, 0, true ); | |
Adverts.service.addEventListener( AdvertEvent.USER_EVENT_SHOW_AD, adverts_userShowAdHandler, false, 0, true ); | |
if (Adverts.service.isPlatformSupported( AdvertPlatform.PLATFORM_ADMOB )) | |
{ | |
Adverts.service.initialisePlatform( AdvertPlatform.PLATFORM_ADMOB, ADMOB_ACCOUNT_ID ); | |
var size:AdvertPosition = new AdvertPosition(); | |
size.verticalAlign = AdvertPosition.ALIGN_BOTTOM; | |
size.horizontalAlign = AdvertPosition.ALIGN_RIGHT; | |
Adverts.service.showAdvert( size ); | |
} | |
else | |
{ | |
trace( "platform not supported" ); | |
} | |
} | |
else | |
{ | |
trace( "Adverts not supported" ); | |
} | |
} | |
catch (e:Error) | |
{ | |
trace( e.message ); | |
} | |
// com.distriqt.Adverts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment