Ich habe eine einfache Bildergalerie, wo Bilder in einem Ordner in einem Container auf der Bühne angezeigt werden. Die Bilder werden durch
Schaltflächen jeweils weiter und zurück angezeigt.
Nachfolgendes Script verwende ich. Das Problem ist, ab dem 5. Bild wird mir nix mehr angezeigt. Mit 4 Bildern funktioniert es immer einwandfrei.
PHP-Code:
this.loadVariables("../_images/flash/bilder/GE.txt");
ausgabe_txt.text = "Lade Daten...";
var anzBild;
MovieClip.prototype.fade = function(bol) {
this.onEnterFrame = function() {
this._alpha -= (bol) ? -10 : 10;
(this._alpha>=100 && bol || this._alpha<=0 && !bol) ? delete this.onEnterFrame : "";
};
};
ASSetPropFlags(String.prototype,"fade",1,true);
this.onData = function() {
// Felder erzeugen
bildEintrag = new Array();
bildTitel = new Array();
// Einträge Trennen
bildEintrag = daten.split(",");
// BildTitel+URL
for (var i = 0; i<bildEintrag.length; i++) {
bildTitel.push(bildEintrag[i].split("|"));
}
// Filmsequenz Erzeugen
obj = this.createEmptyMovieClip("mc0", 1);
obj2 = obj.createEmptyMovieClip("con", 1);
// Bild in die Filmsequenz laden
obj2.loadMovie(bildTitel[0][1],"mc0");
// Positionieren
obj._x = 39;
obj._y = 68;
anzBild = obj;
//this.mc._alpha = 0;//zuerst transparent
// Textfeld mit Bildnamen
ausgabe_txt.text = bildTitel[0][0];
};
weiter.onRelease = function() {
// Nächstes Bild
if (bild<bildTitel.length-1) {
bild++;
obj = this._parent.createEmptyMovieClip("mc"+bild, bild+1);
obj2 = obj.createEmptyMovieClip("con", 1);
obj2.createEmptyMovieClip("con",1);
//trace (obj);
obj._alpha = 1;
obj._x = 39;
obj._y = 68;
loadMovie(bildTitel[bild][1], obj2);
obj.fade(true);
anzBild.fade(false);
anzBild = obj;
ausgabe_txt.text = bildTitel[bild][0];
}
};
zuruck.onRelease = function() {
// Vorheriges Bild
if (bild>0) {
bild--;
obj = this._parent.createEmptyMovieClip("mc"+bild, bild+1);
obj2 = obj.createEmptyMovieClip("con", 1);
obj._alpha = 0;
obj._x = 39;
obj._y = 68;
obj2.loadMovie(bildTitel[bild][1]);
obj.fade(true);
anzBild.fade(false);
anzBild = obj;
ausgabe_txt.text = bildTitel[bild][0];
}
};
Das steht dann jeweils in der txt.datei drin:
daten=text-1 - Bild 1|../_images/flash/bilder/angebote_GE_1.jpg,
Text-2 - Bild 2|../_images/flash/bilder/GE_2.jpg,
Text-3 - Bild 3|../_images/flash/bilder/GE_3.jpg,
Text-4 - Bild 4|../_images/flash/bilder/4.jpg,
Text-5 - Bild 5|../_images/flash/bilder/5.jpg
Vielen Dank im voraus
F.
mod edit: code formatiert für bessere lesbarkeit!