listing files in a folder using as3
I want to get a list images insid开发者_运维问答e a folder but in order to do that, I need to get the names all the files inside a folder first. What flash class should I look into to allow me to do this?
EDIT: how about doing this using php? what should I return/echo on my php file?
Flash can only directly manipulate, read, and modify the local filesystem. If you are looking to have Flash running on a website and accessing a directory listing of remote files, you'll need to fall back to a server-side technology that can provide Flash with a listing.
If you're trying to read off of the client's filesystem, you are looking for flash.net.FileReference, or if you are using Adobe Air, flash.filesystem.File.
For your edit, PatrickS's suggestion of scandir sounds very good. You can have PHP echo out an XML file if you'd like and request that PHP file via Flash as if you were loading XML, see an old answer of mine here: Pass xml data to a swf object
wouldn't it be possible to use the PHP function scandir() http://us.php.net/manual/en/function.scandir.php
and return the result to Flash?
the question doesn't actually mentions remote directories...
It's not possible to list the contents of remote directories over HTTP unless the server is specifically set up to reveal them. This is quite unusual. The normal way to approach this would be to supply a list of URLs to your Flash movie in a config file (XML or plain text) which lives in a known location. This might be generated by a server backend, or assembled by hand.
精彩评论