问题描述
我试图将图像文件保存到我的航空项目的applicationStorageDirectory目录中。首先创建目录
var imageDirectory:File = File.applicationStorageDirectory.resolvePath(vispics);
if(imageDirectory.exists)
{
Alert.show(目录已经存在);
}
else {
imageDirectory.createDirectory();
Alert.show(imageDirectory.nativePath);
$ / code>
下一部分是从我的cam中保存图像,现在保存到applicationStorageDirectory 。这里是我怎么做的
$ b $ pre $ var randInt:int = Math.random()*(99999 - 1001)+ 1001;
var randStr:String = randInt.toString();
var filename:String =+ randStr +。jpg;
var file:File = File.applicationStorageDirectory.resolvePath(filename);
var wr:File = new File(file.nativePath);
var stream:FileStream = new FileStream();
stream.open(wr,FileMode.WRITE);
stream.writeBytes(imageData,0,imageData.length);
stream.close();
有没有办法将图像存储在我的vispics目录中?
在此先感谢。
试试:
var file:File = File.applicationStorageDirectory.resolvePath(vispics /+ filename);
I was trying to save an imagefile to a directory in applicationStorageDirectory of my air project. Created the directory first
var imageDirectory:File = File.applicationStorageDirectory.resolvePath("vispics");
if (imageDirectory.exists)
{
Alert.show("Directory Already Exists");
}
else {
imageDirectory.createDirectory();
Alert.show(imageDirectory.nativePath);
}
The next part is saving image from my cam right now it saves to the applicationStorageDirectory. Here is how i do it
var randInt:int = Math.random() * (99999 - 1001) + 1001;
var randStr:String = randInt.toString();
var filename:String = ""+randStr+".jpg";
var file:File = File.applicationStorageDirectory.resolvePath( filename );
var wr:File = new File( file.nativePath );
var stream:FileStream = new FileStream();
stream.open( wr , FileMode.WRITE);
stream.writeBytes ( imageData, 0,imageData.length );
stream.close();
Is there a way that i can store the image in my "vispics" directory?Thanks in advance.
Try:
var file:File = File.applicationStorageDirectory.resolvePath("vispics/" + filename);
这篇关于将图像保存在applicationStorageDirectory的目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!