This content has been marked as final. Show 3 replies
No way to do this with Flash alone. Flash can't look through a folder and find the file names. So you will have to use some back end thing like PHP to provide Flash with the names or you will have to come up with something else.
A simple solution is to create a simple document that holds the names you want to load. This could be an XML or text document and then use either XML or LoadVars classes to load the information.
Once the information is provided – either from a back end system or datafile – you can use the MovieClipLoader class to load the images in any order you desire.
I'm not sure what happens when you try to load an non-existing file. If there's a way to detect that the file doesn't exist (maybe through getBytesTotal()), then it could be possible to just load the next file when the button is pressed, and in case the file doesn't exist, start again with the first image.
This is just an idea, and would need special named files (1.jpg, 2.jpg ...), but maybe it's worth a try. If you test it, please tell if it's working.
With the MovieClipLoader there is an onLoadError event. You could also use a setInterval and check the getBytesTotal or getBytesLoaded to see if the file is there. You can also use the XML class to "load" an image – it doesn't care what format the file is.If it doesn't load then it will return "false" to the XML.onLoad event. If it returns true then you know the file exists and can reload – should be faster 'cause the file is in cache – it with loadMovie.
The only other problem I see is that the OP has listed files like 1, 2, 3, 3a, 4… That will make the "load and see" approach quite complex – doable, but complex. Additionally I've found (unless I'm doing it myself) that it is quite difficult to get people to conform file names to a predefined system. So if this system will require collaboration my personal view is that it would be doomed.