biju
biju

Reputation: 11

Flash AS3 not loading the xml when accessed online

Helo

I am getting the xml data in my flash envronment by Test Movie. But when uploaded it does not displays the data. Note that here I have not loading a physical file with .xml extension rather i am loading a url reference which creats an xml structure for this flash object to use.

The code is given below:

var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, showXML);
xmlLoader.load(new URLRequest("http://www.warraq.cc/Core/waraq/quiz-getcurrentexam"));
function showXML(e:Event):void {
XML.ignoreWhitespace = true;
var songs:XML = new XML(e.target.data);
trace(songs);
b.text = songs; //b is the name given to the text box which is a TLF text box
}

/// code ends

the uploaded url is : http://evuae.com/desben/quiz/tst2.html

It loads the data during Testing the swf but fails when accessed via the link above.

Any help much appreciated.

Upvotes: 1

Views: 1250

Answers (3)

George Carlin
George Carlin

Reputation: 447

I have the same problem and i managed to solve it. The problem was simply about that i have the xml file with the name "Gallery.xml". But i was loading it with non-captlized G letter like this:

myXMLLoader.load(new URLRequest("gallery.xml"));

and that will always works offline (on your own pc) - but not online. so I just change the code like this:

myXMLLoader.load(new URLRequest("Gallery.xml"));

and everything worked very awesome.

Upvotes: 1

Joshua Maerten
Joshua Maerten

Reputation: 183

var xmlLoader:URLLoader = new URLLoader(); 
xmlLoader.addEventListener(Event.COMPLETE, showXML); 
xmlLoader.load(new URLRequest("http://www.warraq.cc/Core/waraq/quiz-getcurrentexam.xml"));

function showXML(e:Event):void 
{ 
XML.ignoreWhitespace = true; 
var songs:XML = new XML(e.target.data); 
trace(songs); 
b.text = songs; 
//b is the name given to the text box which is a TLF text box 
} 

your fault is your link got no extention !!

Upvotes: 0

PatrickS
PatrickS

Reputation: 9572

It seems that http://evuae.com doesn't have a crossdomain.xml policy file. Accessing your link returns a Security Error

For testing purposes , create a file called crossdomain.xml and copy this , then load it to your public folder so that it can be accessed at http://evuae.com/crossdomain.xml

 <?xml version="1.0"?> 
 <!DOCTYPE cross-domain-policy SYSTEM 
     "http://www.adobe.com/xml/dtds/cross-domain- policy.dtd">
 <cross-domain-policy>
   <site-control permitted-cross-domain-policies="master-only"/> 
   <allow-access-from domain="*"/> 
 </cross-domain-policy>

Please note that this is the most permissive policy file, so you should get more information about policy files and learn how to make it more restrictive.

http://tv.adobe.com/watch/how-to-develop-secure-flash-platform-apps/crossdomain-policy-files/

Upvotes: 2

Related Questions