Tutorial 3-Manage ad in air with self define configadmin To Published in 2015-07-09 flash air( Read:2321

Manage ad with self define config  in air app


package
{
	import com.keymob.AdSizes;
	import com.keymob.KeymobAd;
	
	import flash.display.Sprite;
	
	public class BannerDemo extends Sprite
	{
		[Embed(source="ads.json",mimeType="application/octet-stream")]
		var jsonConfig:Class;
		public function BannerDemo()
		{
			super();
			var config:String=new jsonConfig();
			KeymobAd.getInstance().initFromJSON(config);
			KeymobAd.getInstance().showBannerABS(AdSizes.BANNER,0,100);
		}
	}
}
1. Get ad config file,we load it from embed file.



[Embed(source="ads.json",mimeType="application/octet-stream")]
var jsonConfig:Class;
var config:String=new jsonConfig();


2. init Keymob,init Keymob from config file we loaded.


KeymobAd.getInstance().initFromJSON(config);
3.show Ad,we show banner at point (0,100)



KeymobAd.getInstance().showBannerABS(AdSizes.BANNER,0,100);





0 Reviews,0 Participation.

Previous 0

Latest comments

No comment Oh!