问题
How do i open file and get its content as a ByteArray in AS3. I saw examples, using FileStream & File classes from flex.filesystem, but the doc says it's for AIR only.
Thanks,
Nava
回答1:
You can try either URLLoader with content set for binary, or use URLStream. What do you need to load ?
回答2:
You can use a FileReference object to browse for a file and then access the raw bytes via the "data" property on the FileReference when the "complete" event is dispatched.
回答3:
Flex security prevents simple access to local files.
The most commonly used workaround is having the user select a file, send that to your server, and then downloading that file from your server.
There is access to some local storage (using SharedObject) for storing and reading settings.
hth,
Koen
回答4:
New feature in Flash 10. Last time you can't read the file directly. But now, you can. http://www.mikechambers.com/blog/2008/08/20/reading-and-writing-local-files-in-flash-player-10/
来源:https://stackoverflow.com/questions/1361200/open-local-files-in-as3