-
Notifications
You must be signed in to change notification settings - Fork 2
/
vpaid-flash.html
79 lines (69 loc) · 2.48 KB
/
vpaid-flash.html
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
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="text-align:center">
<button id="trigger" style="font-size:14px;padding:3px;" disabled>
TriggerFlashAd
</button>
<div id="adElement" style="width:480px; height:270px;background: #000;margin: 20pxauto;"></div>
</div>
</body>
<script type="text/javascript">
/*var vpaidLoader: Loader = newLoader();
vpaidLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onVPAIDLoadComplete);
vpaidLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onVPAIDLoadError);
vpaidLoader.load(newURLRequest("http://cdn-static.liverail.com/swf/v4/admanager.swf"));
*/
(function() {
var LiveRailVPAID,
vpaidFrame,
vpaidLoader,
adElement = document.getElementById('adElement'),
trigger = document.getElementById('trigger');
//Definead initialization
trigger.onclick = function() {
var creativeData = {},
environmentVars = {
slot: adElement,
LR_ENVIRONMENT: 'flash',
LR_PUBLISHER_ID: 1331,
LR_TAGS: 'demo'
};
trigger.setAttribute('disabled', 'disabled');
//Initializean ad
LiveRailVPAID.initAd(adElement.offsetWidth, adElement.offsetHeight, 'normal', 512, creativeData, environmentVars);
}
//DefineinitialVPAID setup
function onVPAIDLoad() {
//Subscribetoevents
LiveRailVPAID.subscribe(function() {
LiveRailVPAID.startAd();
}, 'AdLoaded');
LiveRailVPAID.subscribe(function() {
trigger.removeAttribute('disabled');
}, 'AdStopped');
LiveRailVPAID.subscribe(function() {
trigger.removeAttribute('disabled');
}, 'AdError');
//Enabletrigger
trigger.removeAttribute('disabled');
}
//Loadthe LiveRail VPAIDadunit
vpaidFrame = document.createElement('iframe');
vpaidFrame.style.display = 'none';
vpaidFrame.onload = function() {
vpaidLoader = vpaidFrame.contentWindow.document.createElement('script');
vpaidLoader.src = 'http://cdn-static.liverail.com/js/LiveRail.AdManager-1.0.js';
vpaidLoader.onload = function() {
LiveRailVPAID = vpaidFrame.contentWindow.getVPAIDAd();
LiveRailVPAID.handshakeVersion('2.0');
onVPAIDLoad();
};
vpaidFrame.contentWindow.document.body.appendChild(vpaidLoader);
};
document.body.appendChild(vpaidFrame);
}());
</script>
</html>