Hi
Can someone help me with this.
I’ve got the images loading fine with this AS but for some reason the text (description01, 02, 03, 04 in the below code) from the xml isn’t loading and I’ve no idea why!:yikes: I’m probably missing something obvious but any help will be greatly appreciated
Here’s the code:
stop();
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild.childNodes[0].childNodes[0];
image01 = [];
description01 = [];
image02 = [];
description02 = [];
image03 = [];
description03 = [];
image04 = [];
description04 = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image01* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description01* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
image02* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
description02* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
image03* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
description03* = xmlNode.childNodes*.childNodes[5].firstChild.nodeValue;
image04* = xmlNode.childNodes*.childNodes[6].firstChild.nodeValue;
description04* = xmlNode.childNodes*.childNodes[7].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("audio_post_production.xml");
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
button01_mc.onRelease = function() {
gotoAndStop(2);
};
button02_mc.onRelease = function() {
gotoAndStop(1);
};
p = 0;
this.onEnterFrame = function() {
filesize = picture01.getBytesTotal();
loaded = picture01.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture01._alpha<100) {
picture01._alpha += 10;
}
filesize = picture02.getBytesTotal();
loaded = picture02.getBytesLoaded();
preloader02._visible = true;
if (loaded != filesize) {
preloader02.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader02._visible = false;
if (picture02._alpha<100) {
picture02._alpha += 10;
}
filesize = picture03.getBytesTotal();
loaded = picture03.getBytesLoaded();
preloader03._visible = true;
if (loaded != filesize) {
preloader03.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader03._visible = false;
if (picture03._alpha<100) {
picture03._alpha += 10;
}
filesize = picture04.getBytesTotal();
loaded = picture04.getBytesLoaded();
preloader04._visible = true;
if (loaded != filesize) {
preloader04.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader04._visible = false;
if (picture04._alpha<100) {
picture04._alpha += 10;
}
}
}
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture01._alpha = 0;
picture01.loadMovie(image01[p],1);
desc01_txt.text = description01[p];
picture02._alpha = 0;
picture02.loadMovie(image02[p],1);
desc02_txt.text = description02[p];
picture03._alpha = 0;
picture03.loadMovie(image03[p],1);
desc03_txt.text = description03[p];
picture04._alpha = 0;
picture04.loadMovie(image04[p],1);
desc04_txt.text = description04[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture01._alpha = 0;
picture01.loadMovie(image01[p],1);
desc01_txt.text = description01[p];
picture02._alpha = 0;
picture02.loadMovie(image02[p],1);
desc02_txt.text = description02[p];
picture03._alpha = 0;
picture03.loadMovie(image03[p],1);
desc03_txt.text = description03[p];
picture04._alpha = 0;
picture04.loadMovie(image04[p],1);
desc04_txt.text = description04[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture01._alpha = 0;
picture01.loadMovie(image01[0],1);
desc01_txt.text = description01[0];
picture02._alpha = 0;
picture02.loadMovie(image02[0],1);
desc02_txt.text = description02[0];
picture03._alpha = 0;
picture03.loadMovie(image03[0],1);
desc03_txt.text = description03[0];
picture04._alpha = 0;
picture04.loadMovie(image04[0],1);
desc04_txt.text = description04[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
I’ve also uploaded the relevant files. Please help! I’m really stumped on this one and thanks in advance.