Can Flash/Flex be used to create a Windows Explorer type file tree browser?

Tag: flash Author: zhangsanaaaa Date: 2009-07-20

I'm interested in using Flash or Flex to create a File Explorer/Tree which the user can point to a directory on their hard drive, and keep open while they do other things. Similar to TextMate's project drawer, or the file trees on many code editors.

Is it possible to create a local file browser using these technologies, and are you aware of any examples or tutorials using file-structure access, if so?

Please note that this is for a web application, and the file explorer needs to be in the web page. Having a user install an AIR application is not an option.

Best Answer

This can't be done in a SWF within the browser. The only thing you can do for filesystem stuff within the browser is use FileReference, which simply opens the system default open/save dialog and tells you what file the user selected. All other filesystem functionality is restricted to only AIR applications.

The one option is that a web page can trigger the launch of an AIR application. That could run minimized/hidden and do the filesystem stuff and use LocalConnection to communicate back with a SWF within the browser. This would still require the user to install an AIR app though. It also has some security implications and you'd have to be fairly careful with it to make sure you don't accidentally expose filesystem access to SWFs other than your own (else someone else could exploit it).

I wouldn't recommend that, but it's the only thing I can think of that would allow you to do this within a SWF. Flash/Flex simply isn't the right technology to use for some things due to its security (and other) restrictions.

Other Answer1

I advice you to use Adobe Flex, it is very suitable for what you are willing to do. And there is a built-in Tree component.

But I do not believe that using the file system functions of Flex for a web application is easy. The best solution for you would be to deploy it using AIR, users would have to install the application on their system, so the file “explorer” becomes less of a security problem. When deploying for the web, security is a little more stringent.


file system access won't work in a SWF running in a browser. You'd have to make an AIR application in order to have access to the filesystem.

Other Answer2

The adobe air file system example:

Other Answer3

Your best bet is to attempt this in Flex.

It has the controls you need...but I'm not positive as to what level of access it will give you to the user's file system.

Other Answer4

I know a tree has been done nicely with javascript the source code is here, An explanation is here. You could probably edit it to your needs. Remember if you use it on a website you must provide the source code.