3 Replies Latest reply on Feb 25, 2011 7:45 AM by landar

    Erratic Loading of XML Data

    Kwangle Level 1

      Hi All,


      I've set up a holder flash file that checks an XML file every 30 secs, and if the content has changed loads a new movie into itself. I am getting mixed results and baffled why this is not working consistently - the XML is being read successfully, but the attributes that should be read from the XML are being returned as 'undefined' for some reason. Here is the code:


      holderXML = new XML();

      holderXML.ignoreWhite = true;

      holderActive = false;

      function loadSWF(swfNam) {

        //holder movie is called 'mainhold'




      nowMovie = "slidegeneric.swf";

      movieGo = false;


      holderXML.onLoad = function(success) {

      if (success) {

        trace("XML Load Success");

        filelink = this.firstChild.firstChild.attributes.filelink;

        runstatus = this.firstChild.firstChild.attributes.holdstatus;

      if (nowMovie != filelink) {

        //resets movie pause

        movieGo = false;

        //movie changed

        nowMovie = filelink;

        //loads new movie when file has changed



      if (movieGo == false && runstatus == "run") {

        movieGo = true;


      } else {

        trace("XML ERROR");




      function checkHolder() {

      trace("Checking XML");



      //checks holder every 30 secs

      holderTimer = setInterval(checkHolder, 30000);

      //initial load



      the XML is very simple and just contains two attributes, holdstatus and filelink:


      <?xml version="1.0" encoding="UTF-8"?>


      //generic slide = slidegeneric.swf

      <pagestatus holdstatus="wait" filelink = "http://www.mysite.co.uk/mymovie.swf" />



      Totally baffled - any ideas?

        • 1. Re: Erratic Loading of XML Data
          landar Level 1

          If it is truly erratic (sometimes works, sometimes does not) it just smacks of a race (timing) issue.

          • 2. Re: Erratic Loading of XML Data
            Kwangle Level 1

            Thanks for that advice - can you go into a little more details please?


            I've adjusted the code but am still getting puzzling problems, such as the swf loading (showing for an instant on screen) before vanishing and leaving the parent swf blank - refreshing the browser doesn't make any difference. Totally baffled by this, so any help would be greatly appreciated.

            • 3. Re: Erratic Loading of XML Data
              landar Level 1

              Ok, I am going to get up on my soapbox a little. Please bear with me.


              You need to start with basic troubleshooting and work up from there. I am not even sure if this is an intermittent problem or behaves this way all of the time or most of the time, however...


              You start by "hardcoding" so that you pull in only one movie w/o the .xml doing it. If that is rock solid, you know it is probably something in the xml parsing.

              If not, you know it is in the movie itself.

              You can furthermore troubleshoot by isolating the steps that you believe your program should perform and then verifying each of those steps. How? Well, through a combination of hardcoding as I mentioned above AND with a good sniffer. You can get a tool called WireShark for free and it is wonderful for inspecting ethernet packets (with timestamps). You can see when your program asks for the .xml, when it asks for the .swf, etc.

              Once you see what is going on in a methodical manner, your eyes will be opened to the real problem(s)...and there may be multiple problems. Usually are.


              The bottom line is, and I know this from years, no decades of troubleshooting...leave no stone unturned, make NO assumptions. Verify everything. That means taking a detailed look at the traffic.


              \off soapbox :-)