"pulling the data every time that frame comes up."

Is this called on a timeline with many frames and no stop()? If so, I think you are setting a completely new interval on each loop of the frames.

If you want this thing to fire once each minute put it somewhere outside of this loop of frames and call the setInterval

I don't know how your project is set up but alternative is to check if the interval exists and don't spawn a new one, something like:

frame 1:
if (_global.initLoop == undefined) {
  _global.initLoop = setInterval(intervalLoop, 60000);
}

this way your setInterval is called once and will do its thing every minute and independent of the timeline activity.




On Apr 20, 2007, at 5:34 AM, Michael King wrote:


Hey all,

Some of you may remember my problems with visually mapping streaming data before. I ended up needing them as separate clips to provide individual
roll-over support with the ability to add links in a future revision.

Well, now that I have it performing better, I'm breaking down the
information into intervals of 1 minute "bursts". What I'm trying to do is
use setInterval to have it pull the data once per minute.

The problem is, when I use setInterval as documented, it waits the first
minute, does its thing, but then it ignores the interval after that,
pulling the data every time that frame comes up.


Here's the relevant bit of code:

function intervalLoop() {
      xmlData = new XML();
      xmlData.load("wddx.php");
      xmlData.onLoad = function () {
            wddx = new Wddx();
            _root.wddxObj = wddx.deserialize(this);
            delete(xmlData);
      }

      for (j=0; j < _root.lines.length; j++) {
            trace("Deleting clip: " + _root.lines[j]["pen"]._name);
            _root.lines[j]["pen"].removeMovieClip();
            delete(_root.lines[j]["pen"]);
            delete(_root.lines[j]["timestamp"]);
            _root.lines.splice(j,1);
      }

      for (var i in _root.wddxObj) {
            _root.counter++;
            date_now = new Date();
            pen = createEmptyMovieClip("curve_" + i + "_mc", 2 +
_root.counter);
            trace("Added clip: " + pen._name);
            pen.lineStyle(1.5,0xFF6600);
            container = {pen: pen, timestamp: date_now};
            _root.lines.push(container);
            dest_long = _root.wddxObj[i]["long"];
            dest_lat = _root.wddxObj[i]["lat"];
            site = _root.wddxObj[i]["site"];
            src_long = _root.locations[site]["long"];
            src_lat = _root.locations[site]["lat"];
            curvePoint(pen, src_long, src_lat, dest_long, dest_lat);
      }
}

setInterval(intervalLoop, 60000);

Thanks,



_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to