centerimages = 1;
controlheight = previous_btn._height+23;
bodybg._x = 0;
bodybg._y = 0;
bodybg._width = Stage.width+5;
bodybg._height = Stage.height+5;
previous_btn._x = 0;
previous_btn._y = Stage.height-previous_btn._height;
next_btn._x = Stage.width-next_btn._width;
next_btn._y = Stage.height-next_btn._height;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
// listen = new Object();
// listen.onKeyDown = function() {
// if (Key.getCode() == Key.LEFT) {
// prevImage();
// }
// if (Key.getCode() == Key.RIGHT) {
// nextImage();
// }
// };
// Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
preloader._x = Stage.width/2 - preloader._width/2;
preloader._y = (Stage.height-controlheight)/2 - preloader._height/2;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
}
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
if(picture._height >= Stage.height - controlheight){
picture._height = Stage.height - controlheight;
picture._xscale = picture._yscale;
}
if(picture._width >= Stage.width){
picture._width = Stage.width;
picture._yscale = picture._xscale;
}
if(centerimages > 0){
picture._y = (Stage.height-controlheight)/2 - picture._height/2;
picture._x = Stage.width/2 - picture._width/2;
} else {
}<-- die ist zuviel, bitte löschen
picture._y = 0;
picture._x = 0;}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture._yscale = 100;
picture._xscale = 100;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
if(total == p+1){
next_btn._visible = false;
previous_btn._visible = true;
} else {
next_btn._visible = true;
previous_btn._visible = true;
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture._yscale = 100;
picture._xscale = 100;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
if(p < 1){
previous_btn._visible = false;
next_btn._visible = true;
} else {
previous_btn._visible = true;
next_btn._visible = true;
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture._yscale = 100;
picture._xscale = 100;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
previous_btn._visible = false;
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos +” / “+total;
}