Dynamically read files from folder and display as clickable icon

I’d like Flash to read a list of files (MP3’s in one folder and JPG’s in another) and display them in a scene as clickable icons. Does anyone have an example? Thanks.

No input from anyone? :frowning:

you would need something server side to read the files like a php script there are alot of examples out there maybe ask in the server-side forum I would be willing to guide you but I’m not sure how its done code wise… all I can do is point you in the right direction

agreed - flash can’t read the contents of a folder, so you’ll need to use php or asp for example, to determine the number/names of files in a folder on your server. Flash can call the php file, then the php does its thing and spits the results back to flash. You could also set up a manually editable xml doc everytime you upload a file, you could input that into the xml, then call the xml from flash.

Idealy, php editing an XML or a MySQL table would be the thing to do in this case. [whisper]with much emphesis put on MySQL[/whisper]

Defective, why would you choose to use an mySQL table over just opening the folder in PHP and returning the results by reading through the files in the specific folder?

Just an honest question

you shouldn’t - just read the files from the directory

using a mySQL table for this adds several unnecessary steps - which equals more coding.

for example in order to populate this table with the data from the directory you would have to first read the contents of that directory then store the filenames and such in that table.

when you could just go straight from the directory to xml to flash.

get a php script that reads the directory then generates an xml file that contains entries for each file, then read that into flash

or just have the php script read the contents then delimit them, then bring them into flash.

If You’re familiar with VBScript, the attached uses FSO to both gather Folder and File info - you should get the general idea but I didn’t clean up anything so it won’t work as is - you’d have to mold it to your own needs and save it as a .asp file and run it on a Windows server supporting ADO. From this, you should be able to tweak it into a form that could pass variables to Flash.
I don’t know much PHP, so there may be an easier way as PHP seems to be more flexible when it comes to OS’s.