I have XML files with both .swfs and .jpgs externally being loaded into a main
..swf file via clicks from buttons.
The .jpgs and .swfs are loaded into a container entitled "picture"
I have this preloader setup (code below) but the files don't seem to be
preloading. Since the files are being preloaded per click and are being loaded
into a container I am preloading the container and checking if the contents are
loaded and if so then it should fade the image or swf in but it isn't. They
just appear instead of fading in.
Any ideas? I didn't want to use the loader component if I can get away with it.
Thanks
Neil
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
sectitle = [];
thumbnails = [];
client = [];
project = [];
_global.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;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
sectitle[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
client[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
project[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
thumbnailer(i);
}
firstImage();
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(_root.xmlDoc);
/////////Load First Image
Function///////////////////////////////////////////////
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
title_txt.text = sectitle[0];
client_txt.text = client[0];
project_txt.text = project[0];
}
}
/////////Image Preloader
Function//////////////////////////////////////////////////////
p = 0;
preloader._visible = false;
onEnterFrame = function(){
loaded = Math.round(picture.getBytesLoaded());
filesize = Math.round(picture.getBytesTotal());
myPercent = loaded/filesize;
preloader.preload_bar._width = myPercent*150;
myText = Math.round(myPercent*100)+"%";
if (loaded != filesize) {
preloader.preload_bar._width = myPercent*150;
} else {
picture._alpha<100;
picture._alpha += 10;
}
}
//////////Load clicked thumbnail Image
Function////////////////////////////////////////////////
function callImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
client_txt.text = client[p];
project_txt.text = project[p];
}
}