Jump to content
Search Community

Problem: loading XML using LoaderMax

ivzb test
Moderator Tag

Recommended Posts

Hello,

I'm a begginer in actionscript and I'm not sure what I'm missing...

I'm trying to load an external xml file from this url https://microblog.lccv.ufal.br/cgi-bin/microblog.cgi?action=xml_posts&term=%24raphael%5fbastos&format=raw, but it only returns this:


 

I'm used to using the loader class from Flash Pro, so I think I got something wrong during this transition.

What am I doing wrong? It doesn't seem to load/recognize the child node values...

 

 

import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.display.*;

var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onRawLoad:carregar, onError:errorHandler, integrateProgress:false});
queue.append( new XMLLoader("https://microblog.lccv.ufal.br/cgi-bin/microblog.cgi?action=xml_posts&term=%24raphael%5fbastos&format=raw", {name:"xmlData"}) );
queue.load();

var xml:XML; 

function progressHandler(event:LoaderEvent):void {
trace("progress: " + event.target.progress);
trace("total bytes is: " + event.target.bytesTotal);
}

function completeHandler(event:LoaderEvent):void {
   xml = new XML(event.target.content);
trace(xml);
}

function carregar(event:LoaderEvent):void {
//trace("Raw loaded. ");
}

function errorHandler(event:LoaderEvent):void {
   trace("Error - " + event.target + ": " + event.text);
}

Link to comment
Share on other sites

when I try to look at the xml I get a warning about an untrusted site and bad ssl certificate.

 

can you post the raw xml? can you load the xml ok if it is local to your swf?

 

your xml could be malformed or there may be some cross-domain security issues. i really don't know.

 

start by trying to load a local copy of the xml.

 

nothing in your actionscript code jumped out at me as being wrong.

Link to comment
Share on other sites

interesting. for the first time I was able to get this link to work (in a browser) https://microblog.lccv.ufal.br/cgi-bin/ ... format=raw

 

visiting that link in a browser prompts me to save an xml file.

 

the contents of the xml file are:

 




 

isn't that what you reported XMLLoader was loading?

 

I created an xml file also from what you provided here: http://cl.ly/2e2g0P0w3j452L141m15

 

and XMLLoader loads it locally fine.

 

 

Contrary to your results, An AS3 Loader did not successfully load the xml from your server:

 

var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

xmlLoader.load(new URLRequest("https://microblog.lccv.ufal.br/cgi-bin/microblog.cgi?action=xml_posts&term=%24raphael%5fbastos&format=raw"));

function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
trace(xmlData);
}

 

 

The fact that the browser either generates an SSL certificate warning or prompts for a file download instead of displaying the xml leads me to believe that your xml is not being created properly on the server.

 

Perhaps if you provide a small sample of the xml loading fine with out using XMLLoader, we will have a better time troubleshooting what may be going wrong.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...