Refreshing flash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jacksoncn
    New Member
    • Jul 2007
    • 14

    Refreshing flash

    I am using an XML document to display data in flash. I have the swf embedded in html but I now realize that this won't work. You see the xml data needs to be updated every few minutes. Does anyone know of a simple way to refresh the swf so that it can read from the updated XML and display accordingly in the browser ?
  • xNephilimx
    Recognized Expert New Member
    • Jun 2007
    • 213

    #2
    You can use setInterval if you want to update the xml reading in a fixed ammount of time. So the setInterval will call the xml.load function every time the time lapse ends.
    Or simply reload the xml when needed calling the xml.load("thefi le.xml"). May be you want to update the file every time the user does a certain thing.

    If you are going to use the setInterval, you should do something like the following:

    [CODE=actionscri pt]
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    xml.onLoad = function() {
    //the methods to handle the xml
    }

    var intervalID = setInterval(thi s, "loadXML",2*60* 1000);
    //being the interval 2 minutes, since the setInterval uses milliseconds

    function loadXML() {
    xml.load("thefi le.xml");
    }
    [/CODE]

    If in some point you want to stop the interval you should use clearInterval(i ntervalID); and that's it.

    Kind regards.
    The_Nephilim

    Originally posted by jacksoncn
    I am using an XML document to display data in flash. I have the swf embedded in html but I now realize that this won't work. You see the xml data needs to be updated every few minutes. Does anyone know of a simple way to refresh the swf so that it can read from the updated XML and display accordingly in the browser ?

    Comment

    • jacksoncn
      New Member
      • Jul 2007
      • 14

      #3
      thanks. i got it. appreciate it.

      Comment

      • xNephilimx
        Recognized Expert New Member
        • Jun 2007
        • 213

        #4
        Originally posted by jacksoncn
        thanks. i got it. appreciate it.
        You're welcome!
        Good luck with your app!

        Regards,
        The_Nephilim

        Comment

        • crabpot8
          New Member
          • Aug 2007
          • 40

          #5
          there might be a way to reload that part of the page using javascript. look up AJAX if you are still interested in doing it by re-loading the .swf

          crabpot8

          Comment

          Working...