Search code examples
flashactionscript-3google-docs

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=0AhTK6MB0cCLQdDloTFd0TDgzVE04Nm51RTMtM3I3WUE&hl=en&output=csv


Solution

  • 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)