2 Replies Latest reply on Jan 16, 2007 10:05 AM by Aware

    synchronous and asynchronous xml loading?

    Aware
      I have a nested xml.onLoad within a function (with a return statement in the function)
      I need to wait for the xml.onLoad to be triggered before a return statement is sent.

      Flash does not wait for the xml to finish loading it will just return "undefined"; If you list variables in the debugger you will see that the object exists. Because it has had ample time to load. Has any one come across this issue and if so have you come up with a solution
        • 1. Re: synchronous and asynchronous xml loading?
          Matt_C_developer
          Hi,

          If your nested xml.onLoad does not work, could you instead call this at the current xml.onLoad point;

          var intervalID = setInterval(checkXmlStatus, 100);

          and put this function somewhere before this line;

          checkXmlStatus = function() {
          if (my_xml_file.loaded) {
          clearInterval(intervalID);
          // run required actions
          }
          }

          Then, when you call my line of code instead of the xml.onLoad call, the checkXmlStatus function will continually run every 100 milliseconds until your xml file (my_xml_file) has loaded. At this point, it will run whatever you have placed within the checkXmlStatus function.

          This is how I would approach the problem.

          Matt_C_developer

          • 2. Re: synchronous and asynchronous xml loading?
            Aware Level 1
            Hey Matt,

            Below I have attached the basic idea of what I am looking to do. Is it possible for an interval to update a return?