开发者

Getting data directly from Google docs error in AS3

I am trying to load a spreadsheet formatted in CSV directly from Google Docs. I've published it and get this URL, which works great in a browser, and if I run withing the Flash CS5 IDE. When it's running in a web-browser (locally or online), it just hangs and never loads or give an error.

var request:URLRequest=new URLRequest(file); var loader:URLLoader=new URLLoader();

loader.addEventListener(Event.COMPLETE,onLoadXML);

loader.addEventListener(IOErrorEvent.IO_ERROR,onLoadXMLError); loader.load(request);

Any thoughts?

http://spreadsheets.google.com/pub?key=0AhTK6MB0cCLQdDloTFd0TDgzVE开发者_JAVA技巧04Nm51RTMtM3I3WUE&hl=en&output=csv


You can't load across domains like that. It's a potential security issue.

You have a few options:

  • Have google add a crossdomain.xml that allows your domain to do this. (not likely)
  • Use another host for your CSV (easier, but I'm guessing you want the editing from docs)
  • Use a proxy script on a server of yours that loads the file for you (likely the best option)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜