Hey all.
I’m an illustrator trying to save myself some time updating my site with new images by having Flash automatically detect how many images are uploaded to my thumbs directory. The thumbs will be named sequentially (001.jpg, 002.jpg, 003.jpg, etc), and from there I can load them into duplicate movie clips and set up linking to the full size images… but it’s not as easy as I thought.
I’ve been working with the file detection technique found here http://www.flashguru.co.uk/checking-if-a-file-exists/ but I’m not sure it’s giving me the results I need.
If anyone can help with my source code, or suggest a different strategy, it’d be most appreciated.
My current (slightly less Flash-savvy) website can be found at http://inertia.autophobic.net/
Thanks! Code Below________________________________
var FileName:String="";
FileExists=new LoadVars();
FileExists._parent=this;
//makes name of next file to detect
function MakeName(FileNum) {
FileName = “illustration/thumbs/00”+FileNum+".jpg";
}
FileExists.onLoad=function(success){
//success is true if the file exists, false if it doesnt
if(success) {
//the file exists
duplicateMovieClip(thumb, “thumb”+FileNum, FileNum);
thumb.loadClip(FileName);
} else {
//done checking
FileNum=0;
}
while (FileNum>0) {
MakeName(FileNum);
FileExists.load(FileName);
FileNum++;
}