2

I think it's not, but maybe I'm wrong. Anyone?

UPDATE:

It's not.

jayarjo
  • 16,124
  • 24
  • 94
  • 138

2 Answers2

4

i think you can, at least there is nothing in the docs that states otherwise. try adding a ProgressEvent on the FileReference object to read it's data (ByteArray) property after calling load().

however, if you're loading a file with URLLoader, a URLLoader's data property is only populated once the load operation has completed.


[EDIT]

so it's, after all, not possible to access live fileReference data while loading. the docs should explicitly state that it's not possible since it's a valid request.

however, after a some stumbling thru the docs i realized that you can do this by using the URLStream class, which provides methods to read data while it's loading - it's designed to do exactly what you are looking for.

the only catch, in this case, is that URLStream requires a full URL path (URLRequest object), which is not obtainable with FileReference for security reasons - it's only possible to get the name of a selected file, not the complete path. obtaining a local file path in AIR is very easy, but since you want your application to be browser-resistant i'm not quite sure how you'll be able to access file paths from the user's computer - unless they type in the file path, but requiring your users to do so would seriously degrade UX.

Chunky Chunk
  • 16,553
  • 15
  • 84
  • 162
  • I tried. I get null :( It's just that I read somewhere that it's possible, but not sure if it was about FileReference. – jayarjo Jul 09 '11 at 09:49
  • I thought URLRequest was URL related and had nothing to do with local files, no? – jayarjo Jul 11 '11 at 06:10
  • 1
    local files have URLs, too. `http://www.google.com` and `C:\Program Files\file.xml` are both URLs :) both Loader objects and URLLoader objects (and URLStream objects, etc.) receive URLRequests as arguments, but keep in mind that URLLoader is mainly used to load data (text files, XML, or other information to be used in a dynamic, data-driven application) while a Loader is used mainly for loading display objects (swf files or image files). Sound objects have their own load function which also receives a URLRequest argument for local or online .mp3 files. – Chunky Chunk Jul 11 '11 at 08:32
0

It is not possible currently...

jayarjo
  • 16,124
  • 24
  • 94
  • 138