Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 如何获取特定文件夹CameraRoll中的图像列表。加载我的应用程序_Actionscript 3_Flash_Air - Fatal编程技术网

Actionscript 3 如何获取特定文件夹CameraRoll中的图像列表。加载我的应用程序

Actionscript 3 如何获取特定文件夹CameraRoll中的图像列表。加载我的应用程序,actionscript-3,flash,air,Actionscript 3,Flash,Air,我正在AIR/AS3中开发应用程序,不想使用本机设备图像选择屏幕,必须收到列表才能在我的应用程序中创建缩略图(例如:Instagram)。请帮助我此测试用于选择特定文件夹中的任何jpg图像 在这种情况下,sd卡中的“imgs”文件夹 import flash.filesystem.File; var ROOT: File = File.documentsDirectory.resolvePath("imgs/"); /// the directory to read from in the

我正在AIR/AS3中开发应用程序,不想使用本机设备图像选择屏幕,必须收到列表才能在我的应用程序中创建缩略图(例如:Instagram)。请帮助我

此测试用于选择特定文件夹中的任何jpg图像 在这种情况下,sd卡中的“imgs”文件夹

import flash.filesystem.File;


var ROOT: File = File.documentsDirectory.resolvePath("imgs/"); /// the directory to read from in the sd card
var FILES: Array ;// = ROOT.getDirectoryListing();
var fileArr: Array = new Array;


getSubfiles();


function getSubfiles() {
    if (ROOT.exists) {
         FILES = ROOT.getDirectoryListing();
        for (var i: int = 0; i < FILES.length; i++) {
            var File_Ext: String;

            File_Ext = "" + FILES[i].extension;

            if (File_Ext.toLowerCase() == "jpg") {
                fileArr.push(FILES[i].name);
            }
        }
        trace(fileArr);
    } else {
        trace("Folder not existed");
    }
}
导入flash.filesystem.File;
var ROOT:File=File.documentsDirectory.resolvePath(“imgs/”);//sd卡中要读取的目录
变量文件:数组;//=ROOT.getDirectoryListing();
var fileArr:Array=新数组;
getSubfiles();
函数getSubfiles(){
if(ROOT.exists){
FILES=ROOT.getDirectoryListing();
for(var i:int=0;i
别忘了加上

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>


对于你的清单

简单的谷歌搜索会给你无数的答案@kare你好,我是来测试这段代码的。在计算机上,它会正确返回documents文件夹中的所有文件。但当我编译我的应用程序时,没有返回任何内容。似乎无法访问“文档目录”-知道它是什么吗?错误会出现在第一行代码中吗?var docsImages:File=File.documents目录;var getfiles:Array=docsImages.getDirectoryListing();你好@kare。在Android中实现了它的代码,并且工作得非常好。非常感谢。但是,我需要修改以在iOS上运行吗?测试一些文件夹,cóigo总是返回“不存在的文件夹”。我想特别访问“相机卷”。我在等你回来,非常感谢你!