AS3的空气得到的设备文件的具体路径 [英] as3 air get specific path to file on device

查看:85
本文介绍了AS3的空气得到的设备文件的具体路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用AS3空气和测试的机器人。

我需要能够加载,直通一个浏览功能,SD卡 要么 我需要直接指向该文件夹通的路径。

我已经成功下载从服务器的压缩文件。我可以把它解压缩在测试上 我的桌面上,因为我可以浏览到桌面上的正确路径,但无法在手机上。但我并不需要浏览功能反正现在。我只需要能够指向applicationStorgeDirectory和在那里的文件。 :)

我需要的文件VAR:)

  VAR读者:ZipFileReader =新ZipFileReader();
    reader.open(文件); /// 帮帮我 :)
 

更新2012年9月4日下午5点


我想这code:

  var文件:文件= File.applicationStorageDirectory.resolvePath(myFile.zip);
跟踪(file.url); //文件路径
//假设函数采用字符串路径
reader.open(file.url);
 

和我得到这个错误:

 场景1,图层图层1,第1帧,行46
1067年:String类型的值的隐式强制
给无关联的类型flash.filesystem:文件。
 

解决方案

这应该给你一个链接到现有文件

<一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.html#url"相对=nofollow>文件网址

您可以尝试这样的:

  var文件:文件= File.applicationStorageDirectory.resolvePath(myFile.zip);
跟踪(file.url); //文件路径
//假设函数采用字符串路径
reader.open(file.url);
 

I am using as3 air and testing on an android.

I need to able to load, thru a browse feature, the sd card OR I need to point directly to that file folder thru a path.

I have successfully downloaded a zip file from a server. I can unzip it while testing on my desktop because I can browse to the correct path on desktop but not on phone. But I don't need the browse feature anyway, right now. I just need to be able to point to the applicationStorgeDirectory and the file in there. :)

I need the file var :)

var reader:ZipFileReader = new ZipFileReader();
    reader.open(file); /// Help :)

UPDATE Sept 4th 2012 5pm


I tried this code:

var file:File = File.applicationStorageDirectory.resolvePath("myFile.zip");
trace(file.url); //path to the file
//assuming that function takes a string path
reader.open(file.url);

and I got this error:

Scene 1, Layer 'Layer 1', Frame 1, Line 46
1067: Implicit coercion of a value of type String
to an unrelated type flash.filesystem:File.

解决方案

This should give you a url to an existing file

File url

You could try something like this:

var file:File = File.applicationStorageDirectory.resolvePath("myFile.zip");
trace(file.url); //path to the file
//assuming that function takes a string path
reader.open(file.url);

这篇关于AS3的空气得到的设备文件的具体路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆