如何将FileReference和FileSystemTree导入ActionScript

时间:2011-03-01 16:58:03

标签: flex flex4 msxml

我尝试在Flex中插入FileSystemTree。 Flash Builder无法识别并产生错误:

1046: Type was not found or was not a compile-time constant: FileSystemTree

这是代码。这是一个非常基本的......

<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?

1 个答案:

答案 0 :(得分:1)

该组件仅在Adobe AIR应用程序中可用,而不是基于浏览器的Flex应用程序,因为浏览本地文件系统会违反浏览器沙箱。

编辑:既然我理解了您的意图,是的,您可以从Flex应用程序上传文件而无需使用AIR。您可以使用FileReference.browse()来允许用户从本地文件系统中选择要上载的文件,而不是使用FileSystemTree组件(仅限AIR)。文档中的此页面将为您提供所需的所有信息:Working with file upload and download

希望有所帮助。