Obviously I can only have a set amount of pictures so I need to check whether or not the file exists on my server. If it does not exist, it has to load “1.jpg”
The reason I want to check is that I would like to just upload pictures in a sequential order and not touch my fla.
Can someone help me out with a nice if statement that checks whether or not a file exists?
yes, someone can, and his name is PHP…
Flash alone can’t do that, PHP can read all the files in a directory, and if you want, send the list to the swf. See server-side forum for details.
If you don’t want to use a scripting language, then you’ll need to use a text, or better xml config file which you update manually and flash reads in to set up the image viewer.
can be as simple as
< files total=10 / >
PHP also has a file_exists function, that immediately checks if a file exists or not. A lot shorter than getting a list and running through it to see if it’s in there.
There is also a way to check it from Flash, using the LoadVars object. FlashGuru has an article on it I think … yup: http://www.flashguru.co.uk/000310.php