AS3 - URLload local files with absoute path

 ̄綄美尐妖づ 提交于 2020-01-14 03:09:13

问题


I am trying to open local hard drive files inside AS3. I'm getting a security error with this code:

var soundFile:URLRequest = new URLRequest("c:\slushy.mp3");

Is it possible to URLload an absolute path on the hard drive?

Edit: so this appears to be a sandboxing issue. Drat. Is it possible to load the local file via PHP and send to flash?


回答1:


PHP is a server language, so the final protocol is http.

The you must to acces by file:/// to the local file, but if you want to share the resources over Internet, you must upload your files to folder in the root of site.

By example: http://www.mysite.com/music

Then you can load the file:

    var soundFile:URLRequest = new URLRequest("http://www.mysite.com/music/slushy.mp3");

Requisite: you must to create the directory "music" in server web application directory and upload the file.



来源:https://stackoverflow.com/questions/7623348/as3-urlload-local-files-with-absoute-path

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