如何将 FileReference 和 FileSystemTree 导入到 ActionScript
我尝试在 Flex 中插入 FileSystemTree 。 Flash Builder 无法识别这一点并产生错误:
1046: Type was not found or was not a compile-time constant: FileSystemTree
Here's the code 。这是一个非常基本的...
<mx:HDividedBox width="100%" height="725" paddingLeft="10" paddingRight="10" paddingBottom="10" paddingTop="10" y="41">
<mx:VBox width="200" height="100%">
<mx:FileSystemTree id="fileSystemTree" width="100%" height="100%" change="onChange(event)" />
</mx:VBox>
<mx:Canvas width="100%" height="100%" id="content" ></mx:Canvas>
</mx:HDividedBox>
我正在使用 Flex 4、Flash Builder 4。我做错了什么? Flex 4 支持 FileSystemTree 吗?
I tried to insert a FileSystemTree in Flex .
Flash Builder doesn't recognise that and produces the error:
1046: Type was not found or was not a compile-time constant: FileSystemTree
Here's the code . It's a very basic one ....
<mx:HDividedBox width="100%" height="725" paddingLeft="10" paddingRight="10" paddingBottom="10" paddingTop="10" y="41">
<mx:VBox width="200" height="100%">
<mx:FileSystemTree id="fileSystemTree" width="100%" height="100%" change="onChange(event)" />
</mx:VBox>
<mx:Canvas width="100%" height="100%" id="content" ></mx:Canvas>
</mx:HDividedBox>
I'm using Flex 4 , Flash Builder 4. What am i doing wrong ? Is FileSystemTree supported in Flex 4 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该组件仅在 Adobe AIR 应用程序中可用,在基于浏览器的 Flex 应用程序中不可用,因为浏览本地文件系统会违反浏览器沙箱。
编辑:现在我明白了您的意图,是的,您可以从 Flex 应用程序上传文件,而无需使用 AIR。您可以使用 FileReference.browse() 来允许用户从本地文件系统中选择要上传的文件,而不是使用 FileSystemTree 组件(仅限 AIR)。文档中的此页面将为您提供所需的所有信息: 使用文件上传和下载
希望有帮助。
That component is only available within Adobe AIR applications, not browser-based Flex applications, since browsing the local file system would violate the browser sandbox.
EDIT: Now that I understand your intention, yes, you can upload files from a flex application without having to use AIR. Instead of using the FileSystemTree component (which is AIR only), you use FileReference.browse() to allow the user to select a file from the local filesystem to upload. This page from the documentation will give you all the info you need: Working with file upload and download
Hope that helps.