Hi all
I’ve been trying to load a different image if an image doesn’t exist. How I go about it is: I using the loadVars methods, and defined an onLoad event to fire. On successful file load, it should display the associated image, and if the load fails, it should load “noImage.gif”. I have pictures p1.gif…p6.gif and the rest are missing.
for (i=0; i<10; i++){
s = "p" + i + ".gif";
fileExists=new LoadVars();
fileExists._parent=this;
fileExists.onLoad=function(success)
{
//success is true if the file exists, false if it doesnt
if(success)
{
//the file exists
//nm is an existing movie container
nm.loadMovie(sImage); //and load our .swf file into it
}
else
nm.loadMovie('noImage.gif');
}
fileExists.load(sImage); //initiate the test
}
My problem is that file load is always a success, even when the file doesn’t exist, so the else part never fires. I just see a blank where the image should be. If the image exists, it shows up as expected.
TIA