Skip to main content
August 3, 2013
Answered

Getting started with iAd extension

  • August 3, 2013
  • 3 replies
  • 1329 views

Hi,

I recently purchased the iAd extension for ios package from milkman and am having trouble implementing it.

I have followed the Getting Started document but am having no joy. I have attached some screenshots to show how it is set up and the problems.

1) API library included

2) Code used in first frame of test app file

3) Errors received when publishing

4) Errors received when private is taken out

5) When I turn strict mode off and publish, I just get a blank white screen when viewing the app on my iPhone.

Please help!

Thanks!

This topic has been closed for replies.
Correct answer Mark.fromOP

Your problem is right there in the errors. Looks like you are coding on the time line instead of the class. That's fine, but that means get rid of class related things like private function and extends class stuff. That is what your first error is about. When you do that you are getting the second error, here I can see in your code you have set up the listeners for those 2 functions but you do not have the actual function onBannerAdLoaded and onBannerAdFailed. Find those two in the docs or below add them to your code.

function onBannerAdLoaded(e:IAdEvent):void

     {

        trace("banner ad loaded.");

     }

private function onBannerAdFailed(e:IAdErrorEvent):void

    {

        trace("banner ad failed");

    }

The last error is a typo on your part. In line 18 you have a lowercase ad as in Iad it should be IAd, remember flash is very case sensitive. So change it to this.

IAd.iAd.createBannerAd(IAdBannerAlignment.TOP,IAdContentSize.PORTRAIT_AND_LANDSCAPE);

3 replies

Known Participant
August 28, 2015
Known Participant
January 26, 2014
Mark.fromOP
Mark.fromOPCorrect answer
Inspiring
August 7, 2013

Your problem is right there in the errors. Looks like you are coding on the time line instead of the class. That's fine, but that means get rid of class related things like private function and extends class stuff. That is what your first error is about. When you do that you are getting the second error, here I can see in your code you have set up the listeners for those 2 functions but you do not have the actual function onBannerAdLoaded and onBannerAdFailed. Find those two in the docs or below add them to your code.

function onBannerAdLoaded(e:IAdEvent):void

     {

        trace("banner ad loaded.");

     }

private function onBannerAdFailed(e:IAdErrorEvent):void

    {

        trace("banner ad failed");

    }

The last error is a typo on your part. In line 18 you have a lowercase ad as in Iad it should be IAd, remember flash is very case sensitive. So change it to this.

IAd.iAd.createBannerAd(IAdBannerAlignment.TOP,IAdContentSize.PORTRAIT_AND_LANDSCAPE);

August 7, 2013

Hi Mark, thanks for you answer and helping a tired newbie (ish ) out!

Thanks for taking the time, it really helped, I have it working now.

Just a side note, the Iad instead of IAd was actually in the official 'getting started' guide, not sure how I missed it though... Fresh eyes always help!

Thanks again!

Mark.fromOP
Inspiring
August 7, 2013

I believe that, I recall when I first instituted iAd in my app I had the same issue and it stumped me for a while.

Have you considered Milkman's Admob extension, I find Admob a better option, although they have much lower eCPMs than iAd they have insane fill rates, right around 90% where iAd is never above 10% in my experience.Also the same code can be used on iOS and Android.

Also I recently discovered, although have not yet used, Tap for Tap, they provide a free Adobe AIR extension, you can consider that, or all 3 and if one fails call another.

https://tapfortap.com/doc/AdobeAir

Mark