Skip navigation
Currently Being Moderated

Open a file in Flex?

Aug 5, 2008 1:03 PM

By googling, I can find lots of examples of opening a local file in Flash, but none of them work with Flex (for instance, import flash.filesystem.*; )

I can get the target object by using the FileReference, but OnSelect, how can I open that file for reading?

Please note: I do not need to upload it to the server, I only need that data on the client side, and it would be a real pain to have to send it to the server just so that the server could echo it back.

Any help would be appreciated.
  • Currently Being Moderated
    Aug 5, 2008 1:05 PM   in reply to BrandG
    Flex sandbox will not allow opening local resources like files. AIR allows this. Your only option is to send to server then download it, unless you can somehow use ExternalInterface to open it in JavaScript.
    Mark as:
  • Currently Being Moderated
    Aug 5, 2008 1:10 PM   in reply to BrandG
    As I understand it, for security reasons, local files cannot be accessed with Flash. You need to use AIR to access the local file system. Assuming you are creating an AIR app, importing the flash.filesystem.* and; you would do the following...
    private var myFile:File = new File;

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points