VSPACE = 30;
MAXLINES = 7;
line.htmlText = true;
// Load XML presentation file and then call: startPresentation()
pres_xml = new XML();
pres_xml.load("presentation.xml");
pres_xml.ignoreWhite = true;
pres_xml.onLoad = startPresentation;
// Get the rootNode, then the first slide node and
// finally call showSlide(firstSlide);
function startPresentation() {
rootNode = pres_xml.firstChild;
firstSlide = rootNode.firstChild;
currentSlide = firstSlide;
showSlide(firstSlide);
}
// first determine the slide type = $type
// then show right slide
function showSlide($slideNode) {
$type = $slideNode.attributes.type;
switch ($type) {
case "0":
hideSlides();
showSlideType0($slideNode);
break;
case "1":
hideSlides();
showSlideType1($slideNode);
break;
case "2":
hideSlides();
showSlideType2($slideNode);
break;
case "3":
hideSlides();
showSlideType3($slideNode);
break;
}
}
function hideSlides() {
_root.stype0._visible = false;
_root.stype1._visible = false;
_root.stype2._visible = false;
_root.stype3._visible = false;
}
function showSlideType1($slideNode) {
prevScreenLine = _root.stype1.line1;
lineNode = $slideNode.firstChild;
i = 1;
// loop through the XML <line> nodes (lineNode.nextSibling)
// and copy their content (lineNode.firstChild.nodeValue)
// into the textfield instance (currScreenLine.line.text).
do {
currScreenLine = eval("_root.stype1.line" + i );
currScreenLine.line.text = lineNode.firstChild.nodeValue;
PositionLine();
prevScreenLine = currScreenLine;
lineNode = lineNode.nextSibling;
i++;
} while (lineNode != null)
// Clear out extra lines that have no content
for (j=i; j < MAXLINES+1; j++) {
scrnLine = eval("_root.stype1.line" + j );
scrnLine.line.htmlText = "";
}
// make slide visible
_root.stype1._visible = true;
}
// Get the content of the <picture> node and
// load it into slide type 2.
function showSlideType2($slideNode) {
pictNode = $slideNode.firstChild;
_root.stype2.thepicture.loadMovie(pictNode.firstChild.nodeValue);
_root.stype2._visible = true;
}
// Get the individual nodes (title, description, owner, background)
// and populate slide type 0
function showSlideType0($slideNode) {
titleNode = $slideNode.firstChild;
_root.stype0.titleline.line.text = titleNode.firstChild.nodeValue;
descNode = titleNode.nextSibling;
_root.stype0.descline.line.text = descNode.firstChild.nodeValue;
ownerNode = descNode.nextSibling;
_root.stype0.ownerline.line.text = ownerNode.firstChild.nodeValue;
if (! bgLoaded) {
bgNode = ownerNode.nextSibling;
_root.background.loadMovie(bgNode.firstChild.nodeValue);
bgLoaded = true;
}
_root.stype0._visible = true;
}
// Funktion zum Anzeigen vom 3ten Folientyp:
function showSlideType3($slideNode) {
// teilüberschrift anzeigen
teilueberschriftNode = $slideNode.firstChild;
_root.stype3.teilueberschriftanzeige.line.text = teilueberschriftNode.firstChild.nodeValue;
// bildchen anzeigen
bildchenNode = teilueberschriftNode.nextSibling;
_root.stype3.bildchenanzeige.loadMovie(bildchenNode.firstChild.nodeValue);
// stext anzeigen (kurzer Text)
stextNode = bildchenNode.nextSibling;
_root.stype3.stextanzeige.httext.htmlText = stextNode.firstChild.nodeValue;
// ltext anzeigen (längerer Text)
ltextNode = stextNode.nextSibling;
_root.stype3.ltextanzeige.httext.htmlText = ltextNode.firstChild.nodeValue;
// nun alles eingelesen -> einblenden
_root.stype3._visible = true;
}
function PositionLine() {
// make the height of the text box the same as the height of the text in it, plus 5.
currScreenLine.line._height = currScreenLine.line.textHeight + 5;
// position current line below the previous line at a distance of:
// "previous lines text height + VSPACE"
if (currScreenLine != prevScreenLine) {
currScreenLine._y = (prevScreenLine._y + prevScreenLine.line.textHeight + VSPACE);
}
}
function gotoNextSlide() {
if (currentSlide.nextSibling == null) {
return;
} else {
currentSlide = currentSlide.nextSibling;
showSlide(currentSlide);
}
}
function gotoPrevSlide() {
if (currentSlide.previousSibling == null) {
return;
} else {
currentSlide = currentSlide.previousSibling;
showSlide(currentSlide);
}
}
function gotoFirstSlide() {
currentSlide = rootNode.firstChild;
showSlide(currentSlide);
}