infinity with preloader
maxdido Dec 30, 2006 2:23 AMI noticed something strange !!!
When I view my site on a computer with flash version 8.0.24 the preloader works perfect. the percentage is shown from 0 too 100%. But when I go to a computer with flash version 8.0.34 or higher(v9) I get infinity%?
Isn't this strange?
this is the code in frame 1:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
dimensionX = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
description = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
dimensionX = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("portfolio-landscapes.xml");
/////////////////////////////////////
p = 0;
/////////////////////////////////////
/////////////////////////////////////
/*this.onEnterFrame = function() {
filesize = imageholder.mcimage.getBytesTotal();
loaded = imageholder.mcimage.getBytesLoaded();
percentage = Math.floor((loaded/filesize)*100);
preloader._visible = true;
if (loaded != filesize) {
preloader.progressbar._xscale = percentage;
// set the percentage dynamic textfield
preloader.progresstxt.perc.text = percentage+"%";
}
else if (loaded == filesize){
preloader._visible = false;
// done loading image so now we can resize.
// centerpoint of the movieclip "mcimage" to be set as you wish.
mcimageX = 380;
mcimageY = 245;
// now we get the size of the image
imgwidth = imageholder.mcimage._width;
imgheight = imageholder.mcimage._height;
// finally, set new _x and _y position to center the image to the centerpoint
imageholder.mcimage._x = mcimageX-(imgwidth/2);
imageholder.mcimage._y = mcimageY-(imgheight/2);
if (_root.win._width == _root.w && imageholder._alpha<100) {
imageholder._alpha += 10;
}
}
};*/
//////////////////////////////////////////
function nextImage() {
if (p<(total-1)) {
p++;
// 160 = 145 menubalk + 5 kader links + 2x witrand rondom de foto's
_root.w = Number(dimensionX[p])+160;
imageholder._alpha = 0;
imageholder.mcimage.loadMovie(image[p], 1);
mcinfo.desc_txt.text = description[p];
picture_num();
preloadthing();
}
}
function prevImage() {
if (p>0) {
p--;
_root.w = Number(dimensionX[p])+160;
imageholder._alpha = 0;
imageholder.mcimage.loadMovie(image[p], 1);
mcinfo.desc_txt.text = description[p];
picture_num();
preloadthing();
}
}
function firstImage() {
imageholder.mcimage.loadMovie(image[0], 1);
mcinfo.desc_txt.text = description[0];
_root.w = Number(dimensionX[0])+160;
imageholder._alpha = 0;
picture_num();
preloadthing();
}
function picture_num() {
current_pos = p+1;
mcinfo.pos_txt.text = current_pos+"/"+total;
}
/////////////////////////////
function preloadthing() {
this.onEnterFrame = function() {
filesize = imageholder.mcimage.getBytesTotal();
loaded = imageholder.mcimage.getBytesLoaded();
percentage = Math.floor((loaded/filesize)*100);
preloader._visible = true;
if (loaded != filesize && loaded > 0) {
preloader.progressbar._xscale = percentage;
// set the percentage dynamic textfield
preloader.progresstxt.perc.text = percentage+"%";
}
else if (loaded == filesize && filesize > 0){
preloader._visible = false;
// done loading image so now we can resize.
// centerpoint of the movieclip "mcimage" to be set as you wish.
mcimageX = 380;
mcimageY = 245;
// now we get the size of the image
imgwidth = imageholder.mcimage._width;
imgheight = imageholder.mcimage._height;
// finally, set new _x and _y position to center the image to the centerpoint
imageholder.mcimage._x = mcimageX-(imgwidth/2);
imageholder.mcimage._y = mcimageY-(imgheight/2);
if (_root.win._width == _root.w && imageholder._alpha<100) {
imageholder._alpha += 10;
}
}
}
}
WHAT AM I DOING WRONG ????
Thanks,
Max.
When I view my site on a computer with flash version 8.0.24 the preloader works perfect. the percentage is shown from 0 too 100%. But when I go to a computer with flash version 8.0.34 or higher(v9) I get infinity%?
Isn't this strange?
this is the code in frame 1:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
dimensionX = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
description = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
dimensionX = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("portfolio-landscapes.xml");
/////////////////////////////////////
p = 0;
/////////////////////////////////////
/////////////////////////////////////
/*this.onEnterFrame = function() {
filesize = imageholder.mcimage.getBytesTotal();
loaded = imageholder.mcimage.getBytesLoaded();
percentage = Math.floor((loaded/filesize)*100);
preloader._visible = true;
if (loaded != filesize) {
preloader.progressbar._xscale = percentage;
// set the percentage dynamic textfield
preloader.progresstxt.perc.text = percentage+"%";
}
else if (loaded == filesize){
preloader._visible = false;
// done loading image so now we can resize.
// centerpoint of the movieclip "mcimage" to be set as you wish.
mcimageX = 380;
mcimageY = 245;
// now we get the size of the image
imgwidth = imageholder.mcimage._width;
imgheight = imageholder.mcimage._height;
// finally, set new _x and _y position to center the image to the centerpoint
imageholder.mcimage._x = mcimageX-(imgwidth/2);
imageholder.mcimage._y = mcimageY-(imgheight/2);
if (_root.win._width == _root.w && imageholder._alpha<100) {
imageholder._alpha += 10;
}
}
};*/
//////////////////////////////////////////
function nextImage() {
if (p<(total-1)) {
p++;
// 160 = 145 menubalk + 5 kader links + 2x witrand rondom de foto's
_root.w = Number(dimensionX[p])+160;
imageholder._alpha = 0;
imageholder.mcimage.loadMovie(image[p], 1);
mcinfo.desc_txt.text = description[p];
picture_num();
preloadthing();
}
}
function prevImage() {
if (p>0) {
p--;
_root.w = Number(dimensionX[p])+160;
imageholder._alpha = 0;
imageholder.mcimage.loadMovie(image[p], 1);
mcinfo.desc_txt.text = description[p];
picture_num();
preloadthing();
}
}
function firstImage() {
imageholder.mcimage.loadMovie(image[0], 1);
mcinfo.desc_txt.text = description[0];
_root.w = Number(dimensionX[0])+160;
imageholder._alpha = 0;
picture_num();
preloadthing();
}
function picture_num() {
current_pos = p+1;
mcinfo.pos_txt.text = current_pos+"/"+total;
}
/////////////////////////////
function preloadthing() {
this.onEnterFrame = function() {
filesize = imageholder.mcimage.getBytesTotal();
loaded = imageholder.mcimage.getBytesLoaded();
percentage = Math.floor((loaded/filesize)*100);
preloader._visible = true;
if (loaded != filesize && loaded > 0) {
preloader.progressbar._xscale = percentage;
// set the percentage dynamic textfield
preloader.progresstxt.perc.text = percentage+"%";
}
else if (loaded == filesize && filesize > 0){
preloader._visible = false;
// done loading image so now we can resize.
// centerpoint of the movieclip "mcimage" to be set as you wish.
mcimageX = 380;
mcimageY = 245;
// now we get the size of the image
imgwidth = imageholder.mcimage._width;
imgheight = imageholder.mcimage._height;
// finally, set new _x and _y position to center the image to the centerpoint
imageholder.mcimage._x = mcimageX-(imgwidth/2);
imageholder.mcimage._y = mcimageY-(imgheight/2);
if (_root.win._width == _root.w && imageholder._alpha<100) {
imageholder._alpha += 10;
}
}
}
}
WHAT AM I DOING WRONG ????
Thanks,
Max.


