i'm creating an as3 application for android and ios in animate cc. My problem is that i can't add images to the stage from applicationStorageDIrectory, the only thing that i can do is to list them:
var desktop:File =
File.applicationStorageDirectory.resolvePath("imgFlussi/set");
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
}
this is the code with i try to add the images : imgLoader =
imgLoader = File.applicationStorageDirectory.resolvePath("imgFlussi/set/"+valImg+".jpg") as DisplayObject;
cont.addChild(imgLoader);
Your mistake is that File.applicationStorageDirectory.resolvePath(...) returns a File instance, not a DisplayObject. In order for this to work you need to create a Loader instance and actually load it from the file:
var aLoader:Loader = new Loader;
var aRequest:URLRequest = new URLRequest;
aRequest.url = "app-storage:/imgFlussi/set/" + valImg + ".jpg";
aLoader.load(aRequest);
cont.addChild(aLoader);