开发者

How to Import FileReference and FileSystemTree to ActionScript

开发者 https://www.devze.com 2023-02-14 16:50 出处:网络
I tried to insert a FileSystemTree in Flex . Flash Builder doesn\'t recognise that and produces the error:

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:Canv开发者_如何学编程as>
</mx:HDividedBox>

I'm using Flex 4 , Flash Builder 4. What am i doing wrong ? Is FileSystemTree supported in Flex 4 ?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消