0
votes

I am trying to implement an in-app banner with the ANE provided by Code Alchemy @ https://github.com/lancelot1/ane-admob but I get errors every single time. What am I doing wrong? I have already linked the ANE, enabled the linking package and modified the main app.xml.

I'm getting errors (Error 1120: Access of undefined property adMobManager) here:

    if(adMobManager.isSupported)
        {
            adMobManager.verbose = true;
            adMobManager.operationMode = AdMobManager.PROD_MODE;
            adMobManager.bannersAdMobId = "ca-app-pub-5756871557297373/2682945046";
            adMobManager.interstitialAdMobId = "ca-app-pub-5756871557297373/4159678246";
            adMobManager.createBannerAbsolute(AdMobSize.BANNER,AdMobPosition.BOTTOM_CENTER,"BottomBanner1", null, true);
            adMobManager.showBanner("BottomBanner1");
            adMobManager.createInterstitial(null,true);
            adMobManager.showInterstitial();
        }

and Error (1120: Access of undefined property dispatcher) here:

    if (!dispatcher.hasEventListener(AdMobEvent.BANNER_LOADED))
            dispatcher.addEventListener(AdMobEvent.BANNER_LOADED, onBannerLoaded);

full code:

    <?xml version="1.0" encoding="utf-8"?>
    <s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                              xmlns:s="library://ns.adobe.com/flex/spark" applicationDPI="160">
<s:ViewNavigator label="MAPA" width="100%" height="100%" firstView="views.MAPAView"/>
<s:ViewNavigator label="LISTA" width="100%" height="100%" firstView="views.LISTAView"/>
<s:ViewNavigator label="SOBRE" width="100%" height="100%" firstView="views.SOBREView"/>
<fx:Style source="QRApp.css"/>
<fx:Script>
    <![CDATA[
        import com.codealchemy.ane.admobane.*;
        import com.codealchemy.ane.admobane.AdMobManager;
        var adMobManager:AdMobManager = AdMobManager.manager;
        var num:int = adMobManager.bannersQuantity;
        var bannerIds:Array = adMobManager.bannersNames;
        var device:String = adMobManager.device;
        var state:Boolean = adMobManager.isInterstitialLoaded();
        if(adMobManager.isSupported)
        {
            adMobManager.verbose = true;
            adMobManager.operationMode = AdMobManager.PROD_MODE;
            adMobManager.bannersAdMobId = "ca-app-pub-5756871557297373/2682945046";
            adMobManager.interstitialAdMobId = "ca-app-pub-5756871557297373/4159678246";
            adMobManager.createBannerAbsolute(AdMobSize.BANNER,AdMobPosition.BOTTOM_CENTER,"BottomBanner1", null, true);
            adMobManager.showBanner("BottomBanner1");
            adMobManager.createInterstitial(null,true);
            adMobManager.showInterstitial();
        }
        /**
         * Extension event dispatcher instance
         **/
        private function get dispatcher():EventDispatcher
        {
            // Return the extension dispatcher
            return adMobManager.dispatcher;
        }
        if (!dispatcher.hasEventListener(AdMobEvent.BANNER_LOADED))
            dispatcher.addEventListener(AdMobEvent.BANNER_LOADED, onBannerLoaded);


        /**
         * onBannerLoaded Event listener
         *
         * @param e AdMobEvent Object
         **/
        static private function onBannerLoaded(e:AdMobEvent):void
        {
            // Do Something like show the banner...
            adMobManager.showAllBanner();
        }

    ]]>
</fx:Script>
<fx:Declarations>
</fx:Declarations>
<fx:Style source="QRApp.css"/>

1
You don't say what error you are getting. - William
Error 1120: Access of undefined property adMobManager - user8003
@user8003 did you ever get this to work? Im dealing with the same issue from flash builder 4.6. - tamak

1 Answers

0
votes

I don't know if you still have this problem.
However the error message "Error 1120: Access of undefined property adMobManager" it happen when the extension is not correctly declared in the Application.xml.

Please make certain that the Extension is fully declared.

[Added in 28/08/2014]
I made available a full demo application for see and test the setting for Flash Builder 4.7 and Flash Develop.
You can find the sample source code here:
- https://github.com/lancelot1/ane-admob
I believe this project should answer any question on how to integrate the AdMob Ane Extension in either Flash builder 4.7 and Flashdevelop.

I hope this will help anyone with the same problem.