Skip to main content
This topic has been closed for replies.

1 reply

Known Participant
September 9, 2012

how to load advertising in flash air application

This example tells you how to load ads in flash air applications , including the application of the android , iphone, ipad above.

1.down load the lib from http://code.google.com/p/flash-air-admob-ane-for-ios/downloads/list

2.create a mobile project in flash builder

3.add admob.ane to build path

4.create a account of www.admob.com

5.add code as the example,and change the gid (var gid:String="a14fde93a405e01";) to the id of your

6.api of the lib

NativeAds.setUnitId

set the admob ad id .

example:NativeAds.setUnitId("a14fde93a405e01");

NativeAds.setAdMode(true)

set if in in test mode.if you are publishing your app,set it true.if you are testing set false

NativeAds.initAd(0,1,320,50);

create a ad panel,and x 0,y 1,width 320,height 50.the width and height must according to

https://developers.google.com/mobile-ads-sdk/docs/admob/intermediate

NativeAds.showAd(0,1,320,50);

show ad in rect x 0,y 1,width 320,height 50

NativeAds.setLandscape(false);

if want to show portrait ad NativeAds.setLandscape(false),if want to show landscape NativeAds.setLandscape(true).

call this fun after call NativeAds.showAd(0,1,320,50);

NativeAds.hideAd();

hide ad ,just like visible=false;

NativeAds.removeAd();

remove ad just like remove child

NativeAds.getUUID()

get mac address

mark:air sdk 3.1 and highter,mac computer,flash builder 4.6,micro windows cannot use this lib.

my iOS sdk path

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk