admob广告不在android air app中工作

时间:2011-12-05 15:32:34

标签: android air adobe admob

这是我在adobe flash中使用的代码

var _stageWebView:StageWebView;
var myAdvertURL:String = "http://www.xxxxx.com/admob/admob.html";
//
createAd()
//
function createAd():void {
    // check that _stageWebView doersn't exist
    if (! _stageWebView) {
        _stageWebView = new StageWebView () ;
        // set the size of the html 'window'
        _stageWebView.viewPort = new Rectangle(0,0,800,50);
        // add a listener for when the content of the StageWebView changes
        //_stageWebView.addEventListener(LocationChangeEvent.LOCATION_CHANGE,onLocationChange);
        // start loading the URL;
        _stageWebView.loadURL(myAdvertURL);
    }
    // show the ad by setting it's stage property;
    _stageWebView.stage = stage;
}

这是admob.html中的html代码

<body>
<script type="text/javascript">
var admob_vars = {
 pubid: 'xxxxxxxxxxxxxx',
 bgcolor: '000000', 
 text: 'ffffff', 
 ama: false,
 test: false
};
</script>
<script type="text/javascript" src="http://mmv.admob.com/static/iphone/iadmob.js"></script>
</body>

任何人都可以指导我哪里出错了吗?

1 个答案:

答案 0 :(得分:0)

嗨,我认为这段代码可能有效,

import flash.media.StageWebView;
import flash.geom.Rectangle;
import flash.display.Graphics;

var webAd:StageWebView = new StageWebView();
webAd.viewPort = new Rectangle( 0,0,800,50);
webAd.stage = this.stage;

webAd.loadURL( "http://www.google.co.uk" );

只需用您的网址替换Google.co.uk。