-
Can't preload image
Hello,
Right now I'm tryin to preload an image in a scene with a place holder movieclip. I can't get it to preload for the life of me. Does anyone know what I'm doing wrong? anytime I test it, it doesnt work. I have searched the forum and tried all the different examples but can't get it to work. Any help in the matter would be greatly appreciated.
It always skips the preloader, and then is blank until the image actually finishes loading.
frame 1
Code:
placeholder.loadMovie("ext/images/entrees.jpg");
bytes_loaded = Math.round(placeholder.getBytesLoaded());
bytes_total = Math.round(placeholder.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
loadPercent = Math.round(getPercent*100);
loadPercent = loadPercent + "%";
if (bytes_loaded == bytes_total) {
gotoAndPlay(3);
}
frame 2
gotoAndPlay(1);
edit: when I try and test the variable "bytes_total" I do not get any bytes for it, I'm assuming it's how I am referencing the file.
-
if your testing this locally then your preloader may be working cept it just loads instantly, use 'simulated download' under view/simulate download to see if it does anything. i'd also make sure the picture is actually there.
Code:
placeholder.loadMovie("ext/images/entrees.jpg");
should not be in the first frame or do something like
Code:
if(!loadingImg) {
placeholder.loadMovie("ext/images/entrees.jpg");
loadingImg = true;
}
so it doesn't try to reload the image everytime frame 1 is entered.
-
wow, I can't believe I missed that. Thanks for the help