Yes, that's where you're mistaken. setInterval will set an interval that
will call a method at each interval. Whether you assign it to a variable or
not, it will continue to call that method at each interval. This is how
setInterval works. In order to clear an interval, you MUST assign an ID and
call clearInterval on that ID. The functionality you're talking about is a
setTimeout. That calls a method once and ONLY once after a specified delay.


 
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jordan
Snyder
Sent: Friday, April 20, 2007 3:02 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] setInterval woes

No, I mean that he is only calling setInterval once and has no
apparent need to even assign it to a variable for use with
clearInterval later.

On 4/20/07, David Ngo <[EMAIL PROTECTED]> wrote:
> An interval is fired at each interval. What you're talking about is a
> setTimeout which is fired only once after a delay (timeout). An interval
is
> fired an infinite number of times until clearInterval is called.
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Jordan
> Snyder
> Sent: Friday, April 20, 2007 2:03 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: Re: [Flashcoders] setInterval woes
>
> Steven, why is that?  If he's only calling it once and the interval is
> only defined/set once, why would you call clearInterval?
>
> On 4/20/07, Steven Sacks <[EMAIL PROTECTED]> wrote:
> > You should always call clearInterval before setInterval.  ALWAYS.
> >
> >
> > 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,
> > >
> > >
> > > Michael King
> > > CSIRT - Developer
> > > Security Incident Response Group
> > > Humana Inc.
> > > E-mail: [EMAIL PROTECTED]
> > > "STANDS: Some Theoretical Acronym Not Described Sufficiently"
> > >
> > > The information transmitted is intended only for the person or entity
to
> which it is addressed and may contain CONFIDENTIAL material.  If you
receive
> this material/information in error, please contact the sender and delete
or
> destroy the material/information.
> > > _______________________________________________
> > > 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
> > _______________________________________________
> > 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
> >
>
>
> --
> Jordan Snyder
> Applications Developer
> Image Action LLC
> http://www.imageaction.com
> _______________________________________________
> 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
>
> _______________________________________________
> 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
>


-- 
Jordan Snyder
Applications Developer
Image Action LLC
http://www.imageaction.com
_______________________________________________
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

_______________________________________________
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