AS3 AIR - ]清单/计数" dictory内容清单、内容、AIR、QUOT

2023-09-08 13:54:13 作者:Sole 、Memory 独家记忆

使用AS3空气为Android,我可以使用哪些code列出所有或从本地机器上选择的目录数的文件?在这种情况下,我使用Android版AIR。

Using AS3 Air for Android, What code can I use to list all or count the files from a chosen directory on local machine? In this case I am using Air For Android.

然后,我想将它们放在一个数组

Then I would like to put them in an array

我愿意给50分的这个答案。正如你可以看到我代表它的很多,但这个问题是巨大的我。我想,如果可能的,如果我们不使用类包。

I am willing to give 50 pts for this answer. As you can see for my rep it's a lot but this question is HUGE for me. I would like it if possible if we don't use a Class Package.

推荐答案

以下code输出文件和目录包含在用户的桌面目录列表。

The following code outputs a list of files and directories contained in the user's desktop directory.

import flash.filesystem.File;

var desktop:File = File.applicationDirectory.resolvePath("images");
var files:Array = desktop.getDirectoryListing();
for (var i:uint = 0; i < files.length; i++)
{
 trace(files[i].nativePath); // gets the path of the files
 trace(files[i].name);// gets the name
 /// PUT ARRAY CODE HERE to add each "files[i].name" into an array for later use.

}