flash actionscript:
I work for a non-profit organization and we have many branches. Each branch has a separate page. Each one constantly needing to change it's slide show. I'm trying to create a slide show that will create itself. I know that I can read data from .txt files. That isn't a problem, or something I'm worried about. The one thing I see giving me a problem is can I write code that would... Read a directory and create an array of photos which runs with the .txt file to create "objects" that I will call a slide. These slides will have a photo, a url, and a number assigned to them. I know how to assign a number, the url, the problem i'm having is making it read a folder for an X amount of files. X would be changing, a variable number that would be equal to the number of photos in the directory.
You won't be able to make Flash check the number of files in a folder. You can do it with some kind of Perl, PHP, etc. backend thing. For native Flash solutions you have two choices ? have a text or XML file with the names of the files. Since you are already reading in some variables this might be a good choice. Of course you would have to count on other folks updating the text/XML correctly when they change the pictures. Or name the pictures consecutively. Then just cycle through and when you get a load error you know you've reached the end. Of course this will require conforming the naming of photos and giving them consecutive numbers. My experience is that it will be much more difficult to get people to correctly implement choice number 2.
I have an example of this from a tutorial/demo system I've been working on... The XML is simple enough and the ActionScript is rather simple too... As for the updating, I do it by hand at the moment, since I am the only one that makes the changes but I'm sure I could make some php pages to do the changes... PM me if you'd like to see it...
Don't see what you're looking for? Try a search.
|