Flash not loading xml in browser
I have a flash movie that reads an xml file in the same directory as the .swf. This works perfectly when I jus开发者_如何学JAVAt try running the .swf file, but when I add it to my website it cant seem to load the xml file. The swf and xml are in the same directory on the site and I have also tried loading the xml from a url like this: test.load('http://www.mysite.com/flash/doors.xml'); But this wouldnt work either :( any ideas? I'm using Actionscript 2.Thanks.
var test:XML = new XML();
test.ignoreWhite = true;
test.load('doors.xml');
test.onLoad = function(success:Boolean){
if(success){
gotoAndPlay(2);
}
}
Hi maybe you have problems with security, try adding line before loading
System.security.allowDomain("http://www.mysite.com");
I hope this helps.
I think that there is some security issue involved with you`r problem. If you want to avoid configurating security you can try this:
var req:URLRequest = new URLRequest("config.xml");
var url:URLLoader = new URLLoader();
this.loadEvent = loadEvent;
req.digest
url.addEventListener(Event.COMPLETE, loadConfig);
url.load(req);
private function loadConfig(e:Event):void
{
var ldr:URLLoader = e.currentTarget as URLLoader;
var config:XML = new XML(ldr.data);
.....
}
精彩评论