var startx = 10;
var starty = 0;
var breite = 150;
var hoehe = 8;
var farbe = 0xf7f7ce;
var alpha = 70;
var textfarbe = 0xf7f7ce;
var schriftart = "Verdana";
var schriftgroesse = 8;
var schriftfett = 1;
var schriftkursiv = 0;
var schriftunterstrichen = 0;
var textausrichtung = "left";
_root.timeline_mc._x = 260;
_root.timeline_mc._y = 362;
_root.do_mc._x = 160;
_root.do_mc._y = 362;
_root.createEmptyMovieClip("video_mc", 2);
if (_root.size == "small") {
_root.video_mc._x = 90;
_root.video_mc._y = 50;
var frameRate = 25/2;
} else {
_root.video_mc._x = 10;
_root.video_mc._y = 0;
var frameRate = 25;
}
_root.video_mc.loadMovie(_root.mediafile+"_"+_root.size+".swf");
_root.play_btn._visible = false;
_root.pause_btn._visible = true;
_root.pause_btn.onRelease = function() {
_root.pause_btn._visible = false;
_root.play_btn._visible = true;
_root.video_mc.stop();
};
_root.play_btn.onRelease = function() {
_root.play_btn._visible = false;
_root.pause_btn._visible = true;
_root.video_mc.play();
};
_root.createEmptyMovieClip("balken_mc", 3);
balken_mc._x = startx;
balken_mc._y = starty;
with (balken_mc) {
beginFill(farbe, alpha);
lineTo(0, hoehe);
lineTo(breite, hoehe);
lineTo(breite, 0);
lineTo(0, 0);
endFill();
}
for (var i = 1; i<=5; i++) {
_root.createTextField("anzeige"+i, 20+i, startx, starty+(10*i), 300, 20);
anzeigeformat = new TextFormat();
anzeigeformat.color = textfarbe;
anzeigeformat.font = schriftart;
anzeigeformat.size = schriftgroesse;
anzeigeformat.bold = schriftfett;
anzeigeformat.italic = schriftkursiv;
anzeigeformat.underline = schriftunterstrichen;
anzeigeformat.align = textausrichtung;
}
_root.onEnterFrame = function() {
var width = _root.video_mc._width;
var height = _root.video_mc._height;
var t = _root.video_mc.getBytesTotal();
var g = _root.video_mc.getBytesLoaded();
var st = getTimer();
var rt = Math.round((st-at)/1000);
var et = Math.round((t*rt)/g);
var ct = Math.round(-(rt-et));
if (g == t && g>50) {
for (var i = 1; i<=5; i++) {
_root["anzeige"+i].removeTextField();
}
balken_mc.clear();
if (g == t) {
balken_mc.clear();
}
} else {
var a = (g/t)*100;
anzeige1.text = "Es wurden "+Math.round(g/1024)+" Kb von "+Math.round(t/1024)+" Kb geladen";
anzeige1.setTextFormat(anzeigeformat);
anzeige2.text = Math.round(a)+" % geladen";
anzeige2.setTextFormat(anzeigeformat);
//anzeige3.text = "Die abgelaufene Zeit beträgt "+rt+" Sekunden";
//anzeige3.setTextFormat(anzeigeformat);
//anzeige4.text = "Sie müssen sich noch ca. "+ct+" Sekunden gedulden";
//anzeige4.setTextFormat(anzeigeformat);
balken_mc._xscale = a;
}
if (g != 0 && g<=t) {
//Variablendefinitionen
var total = _root.video_mc._totalframes;
var current = _root.video_mc._currentframe;
var x = _root.timeline_mc._x-133;
var y = _root.timeline_mc._y-8;
var a = _root.timeline_mc._x+125;
var b = _root.timeline_mc._y-8;
//Bilder des Films ermitteln
var secTotal = Math.round(total/frameRate);
var secCurr = Math.round(current/frameRate);
//Minuten berechnen
var minTotal = secTotal/60;
var minCurr = secCurr/60;
//Minuten
var min1 = Math.round(minTotal);
var min2 = Math.round(minCurr);
if (min1<10) {
min1 = "0"+min1;
}
if (min2<10) {
min2 = "0"+min2;
}
if (min1>minTotal) {
min1--;
}
if (min2>minCurr) {
min2--;
}
//Sekunden
var secLeft = secTotal%60;
var secGone = secCurr%60;
if (secGone<10) {
secGone = "0"+secGone;
}
//Textfeldausgabe: Zeit
_root.createTextField("timeGone", 30, x, y, 35, 20);
_root.createTextField("timeLeft", 40, a, b, 35, 20);
anGone = new TextFormat();
anGone.color = textfarbe;
anGone.font = schriftart;
anGone.size = 10;
anGone.bold = schriftfett;
anGone.italic = schriftkursiv;
anGone.underline = schriftunterstrichen;
anGone.align = textausrichtung;
anLeft = new TextFormat();
anLeft.color = textfarbe;
anLeft.font = schriftart;
anLeft.size = 10;
anLeft.bold = schriftfett;
anLeft.italic = schriftkursiv;
anLeft.underline = schriftunterstrichen;
anLeft.align = textausrichtung;
timeGone.text = min2+":"+secGone;
timeGone.setTextFormat(anGone);
timeLeft.text = min1+":"+secLeft;
timeLeft.setTextFormat(anLeft);
//Zeitsteuerung
var top = _root.do_mc._y;
var bottom = _root.do_mc._y;
var left = _root.do_mc._x;
var start = _root.timeline_mc._x;
var end = 380;
var faderWidth = _root.timeline_mc._width-(_root.do_mc._width/2);
var segmentWidth = faderWidth/total;
//_root.do_mc._x = 180+((current*segmentWidth)-segmentWidth);
_root.timeline_mc.onRelease = function() {
_root.do_mc._x = _root._xmouse;
};
_root.do_mc.onPress = function() {
_root.video_mc.stop();
_root.do_mc.startDrag(false, 180, 362, 380, 362);
};
_root.do_mc.onRelease = function() {
_root.do_mc.stopDrag();
_root.video_mc.gotoAndPlay(_root.do_mc._x/segmentWidth);
};
}
};