open local files in AS3

╄→гoц情女王★ 提交于 2020-01-04 02:35:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!