0

I am inexperienced so please be patient with my mistakes. Ive never worked with XML before. In my Air app I am trying to load a test XML and display some data in my app.

The xml is simply:

<player>
<highscore>Over9000</highscore>
</player>

My code is:

var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("https://www.dropbox.com/s/0lx69pd73cmboh9/Leaderboard.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void {
   myXML = new XML(e.target.data);
   trace(myXML.highscore);
}

This works fine when I am simply loading the XML from the source folder of my project, but as soon as I try and use the URL I get this error:

Error #1083: The prefix "form" for element "error" is not bound.

1
  • Sorry but your code works. The problem is somewhere else... Commented Oct 19, 2012 at 14:27

1 Answer 1

1

From what I see, https://www.dropbox.com/s/0lx69pd73cmboh9/Leaderboard.xml does not link to a XML, but to an HTML page that wraps its content. What you get in your loader is not the XML you're looking for, but the source code of the dropbox wrapper.

Sign up to request clarification or add additional context in comments.

3 Comments

Oh I see, I was wondering where 'form' and 'error' were coming from.
I found the actual link under: dl.dropbox.com/s/0lx69pd73cmboh9/Leaderboard.xml?dl=1 it works now. Thanks for pointing me in the right direction
Depending on how Dropbox has its permissions set up, you may find that you get cross-domain sandbox issues when you deploy your application on a server. ( ie, if a file is on another domain from the one your swf is on, it will throw an error. This doesn't happen while you are testing in the IDE, so it may appear to work at first. ) If this is the case you can write a very simple php proxy that basically echos the contents of that url, from a location on your own domain. Something like this: echo file_get_contents( 'http://domain.com/data/file.xml' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.