2 Replies Latest reply on Jan 11, 2011 5:46 PM by cepiabuy

    How to Reload XML file in ActionScript?

    cepiabuy

      Hi,

       

      I have a problem with action script.

      How can I reload/update xml file per 5 minutes in actionscript?

      isn't there someway i can do to complete the script?

       

      my script:

      ====================================

       

      delay = 3000;

      //-----------------------

      function loadXML(loaded) {

           if (loaded) {

                xmlNode = this.firstChild;

                schedule = [];

                remark = [];

                term = [];

                total = xmlNode.childNodes.length;

                for (i=0; i<total; i++) {

                     schedule[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;

                     remark[i] = xmlNode.childNodes[i].childNodes[6].firstChild.nodeValue;

                     term[i] = xmlNode.childNodes[i].childNodes[7].firstChild.nodeValue;

                }

                firstData();

           } else {

                content = "file not loaded!";

           }

      }

       

      xmlData = new XML();

      xmlData.ignoreWhite = true;

      xmlData.onLoad = loadXML;

      xmlData.load("mydata.xml");

      p = 0;

       

      function nextData() {

           if (p<(total-1)) {

                p++;         

                schedule_txt.text = schedule[p];

                remark_txt.text = remark[p];

                term_txt.text = term[p];

                slideshow();

           }

      }

      function firstData() {

           schedule_txt.text = schedule[p];

           remark_txt.text = remark[p];

           term_txt.text = term[p];

           slideshow();

      }

      function slideshow() {

           myInterval = setInterval(pause_slideshow, delay);

           function pause_slideshow() {

                clearInterval(myInterval);

                if (p == (total-1)) {

                     p = 0;

                     firstData();

                } else {

                     nextData();

                }

           }

      }

      ===================================