Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Steve

Possible to load dynamically created XML?

Recommended Posts

First, thank you, Jack for the amazing work on this library! Second, I apologize if my question has already been asked / addressed.

 

I have a PHP script that generates XML dynamically. When I try to load the script using an XMLLoader instance, it doesn't work. (I'm using your example code from http://www.greensock.com/loadermax/, all I've done is change the filename being loaded.) I only get two traces from the progressHandler function, and both times it says 0. completeHandler and errorHandler don't fire at all. My XML is well formed, and if I view the page source and save the contents to a static XML file, I am able to load it perfectly. Any ideas on what could be wrong?

 

Thanks again!

Link to comment
Share on other sites

It would be unbelievably helpful if you could post an example that demonstrates the issue. It's very difficult to troubleshoot blind :) Could you post a super-simple FLA that calls the URL you need so that I could CTRL-ENTER and see it failing? I'm not aware of any issues with loading xml (it doesn't care how you create your xml on the servers side, whether it's dynamic or static, etc.). If you don't want to post the FLA here, send it to me as a private message or e-mail. (zip it first please)

Link to comment
Share on other sites

Thanks for the quick response! This has taken a turn for the weird. I've since copied the same exact XML generating script to another server, and my Flash works fine. I've been trying to figure out what could be causing the problem between the combination of the original server, the script, and the Flash but have had no luck. But, considering this works perfectly when I moved the script to another server, I don't think it has anything to do with your code :) I would post the link to the script on the problem server, but I'm under an NDA so I'm afraid I can't. Sorry for the anti-climatic response ;)

 

edit: I'm still getting a few traces of 0 from the progress event handler, and then it just stops. This makes me think the server is hanging...

Link to comment
Share on other sites

What happens when you enter the url to the php script in the browser? If it's working you'll see the xml.

Link to comment
Share on other sites

I'm able to see the XML fine when I view the script in the browser. I should also note that I'm able to load the same script with a regular URLLoader instance with no problem.

Link to comment
Share on other sites

Is it impossible to even put some dummy xml on the server and put together a 3-line FLA or something that demonstrates the issue? I'm not asking for your production files - just SOMETHING that demonstrates the problem. XMLLoader uses a URLLoader internally - I'm not sure why you'd be able to use one without a problem but when doing so in XMLLoader it'd burp. Not saying it didn't happen, but I'm anxious to figure this out and hoping you can help isolate the issue if there is one. Did you listen for errors or failures?

Link to comment
Share on other sites

Hi Jack and Steve,

 

I was having this same problem, and the answer to my problem should have been obvious but took me far too long to troubleshoot.

 

To get the dynamic xml to generate, I had to run it on a server. I was trying to test it in flash. Sounds like this could be the issue here.

 

Once I tested the file on my test server (running MAMP), LoaderMax performed as expected.

 

Thanks!

Link to comment
Share on other sites

  • 4 weeks later...

Hey Everyone,

 

I am having the same problem. You can see this problem if you just paste this code into an FLA.

import com.greensock.events.LoaderEvent;
import com.greensock.loading.XMLLoader;

var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, showXML);
xmlLoader.load(new URLRequest("http://184.106.202.71/blog/wp-includes/feed-hooky.php?mode=blog"));

function showXML(e:Event):void {
//trace("From URLREQUEST: complete" + XML(e.target.data));
trace("From URLREQUEST: complete");
}

var cultureXmlLoader:XMLLoader;
var loaderMaxQueue:LoaderMax;

cultureXmlLoader = new XMLLoader("http://184.106.202.71/blog/wp-includes/feed-hooky.php?mode=blog", {name:"culture", estimatedBytes:801, noCache:true, onOpen:handleOpen, onError:handleError, onFail:handleFail, onSecurityError:handleSecurtyError, onProgress:progressHandler, onComplete:completeHandler});
cultureXmlLoader.load();

function handleError(event:LoaderEvent):void
{
trace("***********Error load handleError");
}
function handleFail(event:LoaderEvent):void
{
trace("***********fail load");
}
function handleOpen(event:LoaderEvent):void
{
trace("***********opening load");
}
function handleSecurtyError(event:LoaderEvent):void
{
trace("***********security error");
}

function completeHandler(event:LoaderEvent):void
{
trace("**********complete");
}

function errorHandler(event:LoaderEvent):void
{
trace("**********errorHandler");
}

function progressHandler(event:LoaderEvent):void
{
trace("**********progressHandler");
}

 

You will notice that the URLRequest gets the XML just fine. But the XMLLoader does not complete. It will "open", and will kick out some progress traces then will just quit. You won't see the fail, error, or securityError functions called either. Thoughts?

 

Thank you,

 

Ben McMaster

http://www.benmcmaster.com

Link to comment
Share on other sites

Sounds like you may have a stale version of XMLLoader - what version are you using?

Link to comment
Share on other sites

Just updated to

 

* VERSION: 1.192

* DATE: 2010-07-15

 

Seems to be working! Thank you for the reply. I thought we were using the latest version.

 

/ben

Link to comment
Share on other sites

Just updated to 1.192...Seems to be working! Thank you for the reply. I thought we were using the latest version.

Yeah, there were some funky bugs in Adobe's URLLoader class (or the Flash Player in various browsers like Chrome and Firefox) that caused it not to report progress correctly in certain situations, so the latest version of XMLLoader has workarounds in place. I suppose that's another reason to use LoaderMax - it works around a bunch of inconsistencies in the standard classes like Loader, URLLoader, NetStream, etc. :)

 

Glad it's working for you now. Thanks for letting us know.

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.
×