来源:http://www.adsmogo.com/help/iosANE
一、iOS ANE植入流程
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="AdsMoGoView"
creationComplete="setupAdsMoGoView(event)"
>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.adsmogo.AdsMoGoView;
import mx.events.FlexEvent;
import spark.events.ViewNavigatorEvent;
private var adsMoGoView:AdsMoGoView;
protected function setupAdsMoGoView(event:FlexEvent):void{
try{
adsMoGoView = new AdsMoGoView();
adsMoGoView.initAdView("ad01030cffa44cab9a664a6ed3f52325",AdsMoGoView.AdViewTypeNormalBanner,false);
adsMoGoView.setAdsMoGoViewOrigin(0,50);
}
catch (e:Error) {}
}
protected function releaseAdsMoGoView(event:ViewNavigatorEvent):void
{
try {
adsMoGoView.releaseAdsMoGoView();
} catch (e:Error) {}
}
]]>
</fx:Script>
</s:View>
public function initAdView(ak:String, adType:int,
expressMode:Boolean):AdsMoGoView
ak:芒果ID,在芒果网站上注册app时生成。
adType 类型:
public static const AdViewTypeNormalBanner:int = 1;
public static const AdViewTypeLargeBanner:int = 2;
public static const AdViewTypeMediumBanner:int = 3;
public static const AdViewTypeRectangle:int =4;
public static const AdViewTypeiPadNormalBanner:int = 8;
AdViewTypeNormalBanner 适用于iphone、ipod touch
AdViewTypeLargeBanner 适用于ipad
AdViewTypeMediumBanner适用于ipad
AdViewTypeRectangle 适用于ipad
AdViewTypeiPadNormalBanner 适用于ipad
expressMode:是否快速模式。false 非快速模式,true 快速模式。
public function releaseAdsMoGoView():void
public function setAdsMoGoViewOrigin(x:int, y:int):void
public function setAdsMoGoViewHidden(hidden:Boolean):void
事件类型 | 事件说明 |
---|---|
ADSMOGO_SRARTAD | 广告开始请求 |
ADSMOGO_RECEIVEAD | 广告接收失败 |
ADSMOGO_FAILGOTAD | 广告轮空 |
ADSMOGO_CLICKAD | 广告点击 |
ADSMOGO_COLSEAD | 广告关闭 |
ADSMOGO_PRESENTFULL | 广告全屏展示 |
ADSMOGO_DISMISSFULL | 广告全屏消失 |
ADSMOGO_WEBBROWSERWILLAPPEAR | 芒果浏览器展示前回调 |
ADSMOGO_WEBBROWSERDIDAPPEAR | 芒果浏览器展示 |
ADSMOGO_WEBBROWSERWILLCOLSED | 芒果浏览器关闭前回调 |
ADSMOGO_WEBBROWSERDIDCLOSED | 芒果浏览器关闭 |
ADSMOGO_WEBBROWSERSHARE | 芒果浏览器分享 |
adsMoGoView.addEventListener(AdsMoGoEvent.ADSMOGO_CLICKAD,adMoGoEventsFun);
adsMoGoView.addEventListener(AdsMoGoEvent.ADSMOGO_RECEIVEAD,adMoGoEventsFun);
protected function adMoGoEventsFun(event:AdsMoGoEvent):void{
trace(event.adMoGoLevel+event.adMoGoResult);
}
原文地址:http://www.cnblogs.com/sunminmin/p/3820721.html