I have a fun addition to a project that could be a great feature for many other people as well. I have a remote directory with a number of images that frequently change in content and quantity.
I am trying to make a text dropdown menu of movieclip buttons with the names of the images, so each image can be loaded and viewed individually. But I want to populate the menu dynamically based on the number of images in the folder and the buttons labeled based either on the filenames or from a separate text file with the names.
——- So I know how to build a text menu through scripting, but I don’t know how to get the information of –1) the number of images or –2) the names. Can this be done through action script?? In case this sounds too easy, the number of images is usually around 50, so it is a scrolling menu. So I guess I also somehow need to –3) define the length of the scrolling menu movieclip, based on the number of buttons it dynamically created. =-)
Any ideas?
Unless it’s an AIR application you can’t make an ActionScript file read contents of a directory by itself (or inspect file system).
Your best option in this scenario is to load a server-side script like PHP that will open a folder and output its contents in XML format. Then your ActionScript file will process this XML and create necessary visual data.
This way you will know that the file data/listing is always up-to-date and foolproof.