5 Replies Latest reply on Apr 30, 2007 8:32 AM by maguskrool

    XML not loading, I guess

    maguskrool Level 1
      Hi. I've been working on this website:


      The main .swf gets a bunch of info from an .xml file, and only after it successfuly loads all that info does it show the site's contents. What I'm getting are very inconsistent results. Sometimes everything works, sometimes something, I'm not sure what, doesn't.

      See the attached code. When the xml loads correctly the .swf should go to the next frame, where authoring-time menus should be visible. I placed a visible MovieClip on the 1st frame as well and whenever the site fails, it doesn't however, remain on the 1st frame, because the MovieClip disappears. It doesn't go to the 2nd frame as it is supposed to, however. So where does it go? Any ideas on what might be causing this? I'm quite new to XML so I'm guessing it might have something to do with it, but it works flawlessly when I test the movie in Flash. I included a sample of what the XML looks like.

      Thank you for your help.

        • 1. Re: XML not loading, I guess
          Greg Dove Level 4
          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.
          • 2. Re: XML not loading, I guess
            maguskrool Level 1
            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.
            • 3. Re: XML not loading, I guess
              Greg Dove Level 4
              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


              after 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

              trace("XML is:"+this.toString());
              just before

              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.

              • 4. Re: XML not loading, I guess
                maguskrool Level 1
                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.
                • 5. Re: XML not loading, I guess
                  maguskrool Level 1
                  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.