-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEBStd.as
executable file
·114 lines (105 loc) · 3.56 KB
/
EBStd.as
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
//****************************************************************************
// EBStd class
//---------------------------
//
//This class containing "top level" Eyeblaster attributes and functions, the class also replaces the _global and _root objects which were removed in AS 3.0 with no replacement.
//(The class contains static attributes and functions in order to simulate global variables/functions).
//
//ALL RIGHTS RESERVED TO MEDIAMIND INC. (C)
//****************************************************************************
package
{
import flash.display.*;
import flash.system.*;
import flash.external.ExternalInterface;
public class EBStd
{
private static var _eb:EBStd = null;
public static var urlParams:Object = new Object(); //URL parameters
//----parameters for saving clickTag value in both ways (clickTag/clickTAG)------
public static var clickTag:String;
public static var clickTAG:String;
public static var clickTARGET:String;
public static var SVversionCT:String="";
public static var flashId:String; //the flash id
//----version------
include "eyeblaster/core/ebVersion.as"
include "eyeblaster/core/compVersion.as"
public function EBStd(objRef)
{
try
{
urlParams = objRef.getChildAt(0).loaderInfo.parameters;
Security.allowDomain(urlParams.ebDomain);
setStaticParams();
_eb = this;
}
catch (error:Error)
{
trace("Error | Exception in constructor: "+ error);
}
}
public static function Init(objRef)
{
try
{
var _stage:Stage = ((String(objRef)=="[object MainTimeline]") || (String(objRef.parent)=="[object Stage]")) ? objRef.stage : objRef;
if(_eb == null)
_eb = new EBStd(_stage);
}
catch (error:Error)
{
trace("Error | Exception in Init function: "+ error);
}
}
//========================
// ebSetComponentName
//========================
//This function allows to identify the different componenets
//parameters -
// compName:String - the component name
public static function ebSetComponentName(compName){}
public static function Clickthrough(name:String = "")
{
var strMsg = "Eyeblaster Workshop | Clickthrough tracked";
trace(strMsg);
// handle SV2 ClickThrough for products or versions
if (SVversionCT!="")
name = SVversionCT;
if (name!="" && name.indexOf("SV2:")!=0)
name = "";
handleCommand("ebClickthrough", name);
}
//=====================
// handleCommand
//=====================
//The function recieve a command and send it to the JS or the container (depending on the ad format)
public static function handleCommand(cmd:String,args:String="")
{
try
{
//send the command to the JS
if((ExternalInterface.available) && (EBStd.flashId != null) && (ExternalInterface.call("ebIsFlashExtInterfaceExist")))
ExternalInterface.call(flashId + "_DoFSCommand", cmd, args);
else
fscommand(cmd,args);
}
catch(error:Error)
{
trace("Error | Exception in handleCommand function: "+ error);
}
}
//======================
// setStaticParams
//======================
//The function sets the static parameters of clickTag (both ways)
//and ebMovie (from 1 to 10) according the values transferred from the JS.
private function setStaticParams()
{
clickTag = urlParams.clickTag;
clickTAG = urlParams.clickTAG;
clickTARGET = urlParams.clickTARGET;
flashId = urlParams.ebFlashID;
}
}
}