This content has been marked as final. Show 5 replies
I can't see any error on first glance. The example of the xml you give is very limited though. You need one set of tags enclosing everything in your xml... so in your example you could not have multiple <person> nodes, but inside <person> you could have multiple name and age nodes.
If you wanted <person> to be repeated, it should be enclosed in something like a top level <people> tag that surrounds everything. This is the XML Object's firstChild and represents the root Node. Apart from any attributes that the root Node might have, you would normally work below that level when you start working with your XML data. Don't know if that's relevant to your issue.
Thanks GWD. I used that sample of XML to show I haven't used neither Schema nor DTD. I'm attaching the real XML here, it's in Portuguese, hope that isn't a problem. There are more <objecto_rita> tags, but I listed only two because they're all the same.
Sorry I'm not sure if I can help you fix the problem... but I just took another look at your code.
I don't think this will help, but I would always put the
xmlObjects.onLoad = XMLcorrect;
(I guess there's pretty much close to zero risk that the load will be finished before your onLoad assignment is made, which is why I don't think it will help).
For your XML, I mirrored what you were doing and it appeared to load OK in flash. Internet explorer and some of the online XML validators gave errors, but regardless it seems to load OK in flash.
You said it works sometimes and other times not. Do you observe this locally or is it just online?
What you describe seems to be data driven, because in theory if the xml loads successfully then it should go to the next frame like you want.
If you do notice the problems locally then to eliminate the XML as the cause of the problem, try putting
The only other thing, but I don't think its relevant is to make sure you have your xml in the correct subdirectory in your online version and not at the same level as your swf. By the way I couldn't access your link when I tried earlier.
Failing all that, you might try using the Xray tool which you can find at osflash.org . It can help with runtime debugging in an online setting, but you'll need to read up on how to use it if you're not familiar with it.
Hi, I meant to reply to this sooner but got caught up in other stuff.
GWD, I did try what you suggested, about exchanging the order of those two code lines, it makes sense and it's probably a good thing to do, just to be on the safe side. Still, my problem persists... The problems are online only, locally it never caused any sort of unexpected behavior. Also, as you suggested, I had already put the .xml file inside a xml directory.
I did run into this:
It's a technote from 2002, saying that .xml files with more than 64kb of data can cause errors. I'm not sure this still applies today, surely there might have been a number of improvements in 5 years that might have improved things. Still, I'll be dividing the .xml into smaller files and see what happens.
I added some frames between the first, with the code, and the one where the loaded XML is used, and I haven't had any problems since then. Still not sure why this works this way, though.