2 Replies Latest reply on Jan 8, 2007 9:27 AM by robertpaquette

    Display contents of folder

      Hi there,
      was wondering if its possible to use script to read the contents of a folder and display them via thumbnails. I want to create a images folder and then when users click on it all the images are displayed and I wont need to update the code when I add images. Anyone help with this?

      Thanks in advance
        • 1. Re: Display contents of folder
          Hi Cookie Monster 1983

          I don't have the whole answer for you... but I do have part of the puzzle.

          It's quite an involved process - so I'll just give you a big picture idea so that you can get started with it.

          To get the filenames, you will have to use some sort of scripting. Most webservers will allow you to use either PHP scripting or ASP scrpting. You'll have to find out which scripting languages your webserver supports. You'll then have to find out how to collect the filenames from the folder using that scripting language. To do this, I suggest you look up ASP or PHP tutorials on the web.

          You then have to set up the .asp page or the .php so that it will write the filenames to a web page in a particular format. Here is an example of the format that is suggested in the actionScript help:


          In that example, 4 variables are defined: company, address, city and zip. Each variable is separated by an amphisand.

          In your case, you probably only want to specify one variable. You may like to call it filenames. If you choose some sort of delimiting character (I quite often use a tilde ~ as it's not generally used in filenames) to separate each filename.

          You then load all of the information in that page using the loadVariablesNum function (see the help in Flash for more details on this). You can then split the big long variable into filenames by using a split operation on an array.

          Once you have the filenames, you could then use the dynamic image loader within flash to create the thumbnails.

          There is an overview of the process for you... I hope you can use that to find out what you need to know.


          • 2. Re: Display contents of folder
            Cookie Monster.

            I have part of the solution (in asp). Sorry, it looks like self-promotion, but see the asp sample code 'Dynamically Fetch a File list ' at the bottom of my experiments page:

            With a little extra work, you can also fetch swf, and/or gifs, and/or etc.

            Good luck.

            robert paquette