/
textSWF.html
142 lines (122 loc) · 4.17 KB
/
textSWF.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
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
<script type="text/javascript">
// pageChanged & sizeChanged functions are needed in every model file
// other functions for model should also be in here to avoid conflicts
var textSWF = new function() {
// function called every time the page is viewed after it has initially loaded
this.pageChanged = function() {
var $playBtn = $("#playBtn");
if ($playBtn.length > 0 && $playBtn.data("state") == "pause") {
$playBtn
.data("state", "play")
.button({
icons: {
primary: "ui-icon-play"
},
label: $playBtn.data("play"),
description: $playBtn.data("play")
});
}
}
// function called every time the size of the LO is changed
this.sizeChanged = function() {
}
}
var $textHolder = $("#textHolder");
var $panel = $("#pageContents .panel");
// text align
var textAlign = x_currentPageXML.getAttribute("align"); // Left|Right
if (textAlign != "Right") {
$panel.addClass("x_floatRight");
} else if (textAlign == "Right") {
$panel.addClass("x_floatLeft");
}
$textHolder.html(x_addLineBreaks(x_currentPageXML.childNodes[0].nodeValue));
var size = ["100%","100%"];
if (x_currentPageXML.getAttribute("movieSize") != "" && x_currentPageXML.getAttribute("movieSize") != undefined) {
var dimensions = x_currentPageXML.getAttribute("movieSize").split(",");
if (Number(dimensions[0]) != 0 && Number(dimensions[1]) != 0) {
size = [Number(dimensions[0]), Number(dimensions[1])];
}
} else {
// ** need to know original swf dimensions **
}
swfobject.embedSWF(eval(x_currentPageXML.getAttribute("url")), "pageSWF", size[0], size[1], "9.0.0", x_templateLocation + "common_html5/expressInstall.swf", "", "", "", function(e) {
/*if (e.success == true) {
var swf = e.ref;
swf.init("Function called from page"); // ** this is not working to call the function in swf - possibly to do with swfObject **
}*/
});
$("#pageSWF h3").html(x_getLangInfo(x_languageData.find("errorFlash")[0], "label", "You need to install the Flash Player to view this content."));
$("#flashImg").attr("alt", x_getLangInfo(x_languageData.find("errorFlash")[0], "description", "Get the Flash Player"));
$("#pageSWF").attr("title", x_currentPageXML.getAttribute("tip"));
if (x_currentPageXML.getAttribute("controls") == "Control Bar" && x_browserInfo.iOS != true) {
var $controls = $('<button id="playBtn"></button>');
$controls
.data({
"state" :"play",
"play" :x_getLangInfo(x_languageData.find("movieController").find("playButton")[0], "label", "Play Button"),
"pause" :x_getLangInfo(x_languageData.find("movieController").find("pauseButton")[0], "label", "Pause Button")
})
.button({
icons: {
primary: "ui-icon-play"
},
label: $controls.data("play"),
description: $controls.data("play"),
text: false
})
.bind("click", function() {
var flashMovie;
if (window.document["pageSWF"]) {
flashMovie = window.document["pageSWF"];
}
if (navigator.appName.indexOf("Microsoft Internet") == -1) {
if (document.embeds && document.embeds["pageSWF"]) {
flashMovie = document.embeds["pageSWF"];
}
} else {
flashMovie = document.getElementById("pageSWF");
}
var $this = $(this);
if ($this.data("state") == "play") {
flashMovie.Play();
$this.data("state", "pause");
} else {
flashMovie.StopPlay();
$this.data("state", "play");
}
var state = $this.data("state");
$this.button({
icons: {
primary: "ui-icon-" + state
},
label: $this.data(state),
description: $this.data(state)
})
})
.load(function() {
})
$panel.append($controls);
}
// call this function in every model once everything's loaded
x_pageLoaded();
</script>
<style type="text/css">
#playBtn {
display: block;
width: 20px;
height: 20px;
}
</style>
<div id="pageContents">
<div id="swfHolder" class="mobileAlign">
<div class="panel inline">
<div id="pageSWF">
<h3></h3>
<p><a href="http://www.adobe.com/go/getflashplayer"><img id="flashImg" src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"/></a></p>
</div>
</div>
</div>
<div id="textHolder">
</div>
</div>