Jacky Lau
Jacky Lau

Reputation: 723

How to load all files in a folder with as3

I need to load a large number of pictures (around 30) in a sequence as a short movie, each .png has the size 960X540.

I don't want the loader depend on the name of each picture as I will make changes frequently.

Is there any suggestions?

Upvotes: 0

Views: 883

Answers (1)

Aaron Beall
Aaron Beall

Reputation: 52133

Are you trying to load images from a local file system, or a remote web server?

If you want to load images from a local file system folder, you can use AIR's File/getDirectoryListing().

If you want to load images from a remote server, and you do not want to rely on a pre-defined file naming pattern, the server will need to be able to provide directory information, for example a PHP script that reads the directory contents and outputs XML or JSON. There's no general way for a client to probe a web server for files in a directory. Some web servers do have a default web directory listing script that shows when there is no "default" file in a folder (index.html, etc), but that probably won't be quite good enough for what you're trying to do.

As a final note, if you don't mind manually updating a file on the server that lists all the files as XML or JSON, you could create a simple AIR app to process a local file directory and generate the necessary XML or JSON and upload that to your server.

Upvotes: 1

Related Questions