I am creating a flash game in Actionscript 3 and Flash CC. I intend to publish the game for iOs and Android.
I am looking for a way to show AdMob ads in Actionscript.
So far I have done those steps but no ads appear anywhere on screen:
- I have downloaded admob_all_in_one6.6.7.ane from here.
- I added the ane to my build path.
I use the code below when the game is starting, before anything else:
import so.cuo.platform.admob.Admob; import so.cuo.platform.admob.AdmobPosition; import so.cuo.platform.admob.AdmobEvent; import so.cuo.platform.admob.AdmobSize; var admob:Admob= Admob.getInstance(); if(admob.supportDevice){ admob.setKeys("9141023615", "6222882810");//changed my keys with random ones admob.addEventListener(AdmobEvent.onInterstitialReceive,onAdReceived); admob.addEventListener(AdmobEvent.onBannerReceive,onAdReceived); admob.cacheInterstitial(); admob.enableTrace=true; } function onAdReceived(event:AdmobEvent):void { if(event.type==AdmobEvent.onBannerReceive){ admob.showBanner(Admob.BANNER,AdmobPosition.TOP_CENTER); } if(event.type==AdmobEvent.onInterstitialReceive){ admob.showInterstitial(); } }
I have tried both banner and interstitial ads and none of them show up. I downloaded the app on my iPad and checked that it passes the if(admob.supportDevice)
stage by showing a dynamic text field on screen.
My questions are:
- I am not quite sure what the "keys" are. So far I copied the part after
/
for each application (ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX
). - If what I did in 1. is correct, do you have any idea why no ads show up?
I have not used AdMob in any other language so I am not too experienced with it.