-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathChartboostTest.mxml
More file actions
156 lines (121 loc) · 7.06 KB
/
Copy pathChartboostTest.mxml
File metadata and controls
156 lines (121 loc) · 7.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
applicationDPI="160"
applicationComplete="init()"
firstView="com.chartboost.sample.air.HomeView">
<fx:Script>
<![CDATA[
import com.chartboost.plugin.air.CBClickError;
import com.chartboost.plugin.air.CBLoadError;
import com.chartboost.plugin.air.Chartboost;
import com.chartboost.plugin.air.ChartboostEvent;
import mx.collections.ArrayCollection;
import mx.collections.IList;
import spark.components.List;
import spark.events.IndexChangeEvent;
private function init():void {
// init
var appId:String;
var appSignature:String;
if (Chartboost.isAndroid()) {
ChartboostTest.log("Chartboost Actionscript Android init()");
appId = "4f7b433509b6025804000002";
appSignature = "dd2d41b69ac01b80f443f5b6cf06096d457f82bd";
} else if (Chartboost.isIOS()) {
ChartboostTest.log("Chartboost Actionscript iOS init()");
appId = "4f21c409cd1cb2fb7000001b";
appSignature = "92e2de2fd7070327bdeb54c15a5295309c6fcd2d";
}
Chartboost.getInstance().startWith(appId, appSignature);
addDelegateMethods();
}
private function addDelegateMethods():void {
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_FAIL_TO_LOAD_INTERSTITIAL, function (location:String, error:CBLoadError):void {
ChartboostTest.log( "Chartboost: on Interstitial failed to load " + location + " for reason " + error.Text );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CLICK_INTERSTITIAL, function (location:String):void {
ChartboostTest.log( "Chartboost: on Interstitial clicked: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CLOSE_INTERSTITIAL, function (location:String):void {
ChartboostTest.log( "Chartboost: on Interstitial closed: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_DISMISS_INTERSTITIAL, function (location:String):void {
ChartboostTest.log( "Chartboost: on Interstitial dismissed: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CACHE_INTERSTITIAL, function (location:String):void {
ChartboostTest.log( "Chartboost: on Interstitial cached: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_DISPLAY_INTERSTITIAL, function (location:String):void {
ChartboostTest.log( "Chartboost: on Interstitial showed: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_FAIL_TO_LOAD_MOREAPPS, function (location:String, error:CBLoadError):void {
ChartboostTest.log( "Chartboost: on More Apps failed to load " + location + " for reason " + error.Text );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CLICK_MORE_APPS, function (location:String):void {
ChartboostTest.log( "Chartboost: on More Apps clicked: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CLOSE_MORE_APPS, function (location:String):void {
ChartboostTest.log( "Chartboost: on More Apps closed: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_DISMISS_MORE_APPS, function (location:String):void {
ChartboostTest.log( "Chartboost: on More Apps dismissed: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CACHE_MORE_APPS, function (location:String):void {
ChartboostTest.log( "Chartboost: on More Apps cached: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_DISPLAY_MORE_APPS, function (location:String):void {
ChartboostTest.log( "Chartboost: on More Apps showed: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_FAIL_TO_RECORD_CLICK, function (location:String, error:CBClickError):void {
ChartboostTest.log( "Chartboost: on click failed to record " + location + " for reason " + error.Text );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_FAIL_TO_LOAD_REWARDED_VIDEO, function (location:String, error:CBLoadError):void {
ChartboostTest.log( "Chartboost: on Rewarded Video failed to load " + location + " for reason " + error.Text );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CLICK_REWARDED_VIDEO, function (location:String):void {
ChartboostTest.log( "Chartboost: on Rewarded Video clicked: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CLOSE_REWARDED_VIDEO, function (location:String):void {
ChartboostTest.log( "Chartboost: on Rewarded Video closed: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_COMPLETE_REWARDED_VIDEO, function (location:String, reward:int):void {
ChartboostTest.log( "Chartboost: on Rewarded Video completed " + location + " for reward " + reward );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CACHE_REWARDED_VIDEO, function (location:String):void {
ChartboostTest.log( "Chartboost: on Rewarded Video cached: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_DISMISS_REWARDED_VIDEO, function (location:String):void {
ChartboostTest.log( "Chartboost: on Rewarded Video dismissed: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_DISPLAY_REWARDED_VIDEO, function (location:String):void {
ChartboostTest.log( "Chartboost: on Rewarded Video showed: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_COMPLETE_APP_STORE_SHEET_FLOW, function ():void {
ChartboostTest.log( "Chartboost: did complete iOS app store sheet flow" );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.WILL_DISPLAY_VIDEO, function ():void {
ChartboostTest.log( "Chartboost: will display video" );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_CACHE_INPLAY, function (location:String):void {
ChartboostTest.log( "Chartboost: on InPlay cached: " + location );
});
Chartboost.getInstance().addDelegateEvent(ChartboostEvent.DID_FAIL_TO_LOAD_INPLAY, function (location:String, error:CBLoadError):void {
ChartboostTest.log( "Chartboost: on InPlay failed to load " + location + " for reason " + error.Text );
});
}
public static function log(txt:String):void {
Chartboost.nativeLog(txt);
trace(txt);
}
public static function deselectAction(event:IndexChangeEvent, dataProvider:IList):void {
var target:List = event.target as List;
target.dataProvider = new ArrayCollection();
target.dataProvider = dataProvider;
var _itemRenderer:IFactory = target.itemRenderer;
target.itemRenderer = null;
target.itemRenderer = _itemRenderer;
}
]]>
</fx:Script>
</s:ViewNavigatorApplication>