Re: [Flashcoders] setInterval woes

2007-04-23 Thread Steven Sacks
It's debugging 101.  Eliminate the obvious things first.  Calling 
clearInterval before setInterval is a preventative measure to protect 
you from unexpected behavior from accidental orphaning of intervals. I 
ALWAYS ALWAYS ALWAYS clearInterval before I setInterval regardless of 
whether it is the first time I'm setting it.  There is no reason not to 
do it and plenty of reason to do it.


If you overwrite a reference to an interval with another interval, you 
orphan that interval which continues to run in the swf until you close 
the swf and you will never be able to stop it unless you knew the id of 
the interval in question.


The reason I suggested it was because his code was not well written in 
that there was no protection that the interval would be overwritten 
since it was in a frame script.  If that frame ever played again you 
would have an interval orphaned and then doubled up.  From the 
description of the behavior he gave, that's exactly what it sounded like.





Jordan Snyder wrote:

Nevermind.  I'm obviously not communicating very well.  I'm extremely
familiar with setInterval's and setTimeout's functionality.  What I'm
trying to figure out is why Steven says to clearInterval first
clearInterval can not be run without an argument, so I'm saying that
if you haven't assigned setInterval to something, what are you going
to call clearInterval on?  And why would you call it before it's even
assigned to an actual interval?

Cheers

On 4/20/07, David Ngo [EMAIL PROTECTED] wrote:

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

RE: [Flashcoders] setInterval woes

2007-04-23 Thread David Ngo
And to add to what Steven said, I would seriously suggest using the scope
version of the setInterval call:

var interval:Number = setInterval(this, 'myFunc', 100);


Using setInterval this way specifies the scope object you want to call your
method on. This also goes a long way to ensuring that your interval will
work as you intended it to.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
Sent: Monday, April 23, 2007 10:06 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] setInterval woes

It's debugging 101.  Eliminate the obvious things first.  Calling 
clearInterval before setInterval is a preventative measure to protect 
you from unexpected behavior from accidental orphaning of intervals. I 
ALWAYS ALWAYS ALWAYS clearInterval before I setInterval regardless of 
whether it is the first time I'm setting it.  There is no reason not to 
do it and plenty of reason to do it.

If you overwrite a reference to an interval with another interval, you 
orphan that interval which continues to run in the swf until you close 
the swf and you will never be able to stop it unless you knew the id of 
the interval in question.

The reason I suggested it was because his code was not well written in 
that there was no protection that the interval would be overwritten 
since it was in a frame script.  If that frame ever played again you 
would have an interval orphaned and then doubled up.  From the 
description of the behavior he gave, that's exactly what it sounded like.




Jordan Snyder wrote:
 Nevermind.  I'm obviously not communicating very well.  I'm extremely
 familiar with setInterval's and setTimeout's functionality.  What I'm
 trying to figure out is why Steven says to clearInterval first
 clearInterval can not be run without an argument, so I'm saying that
 if you haven't assigned setInterval to something, what are you going
 to call clearInterval on?  And why would you call it before it's even
 assigned to an actual interval?
 
 Cheers
 
 On 4/20/07, David Ngo [EMAIL PROTECTED] wrote:
 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

Re: [Flashcoders] setInterval woes

2007-04-23 Thread Steven Sacks
Yes!  Always pass the scope when using setInterval.  I think it's bad 
that they even included the option to not pass the scope.



David Ngo wrote:

And to add to what Steven said, I would seriously suggest using the scope
version of the setInterval call:

var interval:Number = setInterval(this, 'myFunc', 100);


Using setInterval this way specifies the scope object you want to call your
method on. This also goes a long way to ensuring that your interval will
work as you intended it to.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
Sent: Monday, April 23, 2007 10:06 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] setInterval woes

It's debugging 101.  Eliminate the obvious things first.  Calling 
clearInterval before setInterval is a preventative measure to protect 
you from unexpected behavior from accidental orphaning of intervals. I 
ALWAYS ALWAYS ALWAYS clearInterval before I setInterval regardless of 
whether it is the first time I'm setting it.  There is no reason not to 
do it and plenty of reason to do it.


If you overwrite a reference to an interval with another interval, you 
orphan that interval which continues to run in the swf until you close 
the swf and you will never be able to stop it unless you knew the id of 
the interval in question.


The reason I suggested it was because his code was not well written in 
that there was no protection that the interval would be overwritten 
since it was in a frame script.  If that frame ever played again you 
would have an interval orphaned and then doubled up.  From the 
description of the behavior he gave, that's exactly what it sounded like.





Jordan Snyder wrote:

Nevermind.  I'm obviously not communicating very well.  I'm extremely
familiar with setInterval's and setTimeout's functionality.  What I'm
trying to figure out is why Steven says to clearInterval first
clearInterval can not be run without an argument, so I'm saying that
if you haven't assigned setInterval to something, what are you going
to call clearInterval on?  And why would you call it before it's even
assigned to an actual interval?

Cheers

On 4/20/07, David Ngo [EMAIL PROTECTED] wrote:

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

Re: [Flashcoders] setInterval woes

2007-04-23 Thread Jordan Snyder

Isn't using Delegate (with setInterval) one step better or are there caveats?

Steven, what I don't understand is why, if the intervals are getting
orphaned, you wouldn't have the data being pulled much MORE often
instead of less often.  I'm aware of the issues with orphaning an
interval (and just assumed that this code was in a class or was only
called once) but I don't understand the resultant behavior in relation
to what you're saying.

Michael, haven't heard from you in a while...did you work it out?

Cheers!

On 4/23/07, Steven Sacks [EMAIL PROTECTED] wrote:

Yes!  Always pass the scope when using setInterval.  I think it's bad
that they even included the option to not pass the scope.


David Ngo wrote:
 And to add to what Steven said, I would seriously suggest using the scope
 version of the setInterval call:

 var interval:Number = setInterval(this, 'myFunc', 100);


 Using setInterval this way specifies the scope object you want to call your
 method on. This also goes a long way to ensuring that your interval will
 work as you intended it to.


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
 Sent: Monday, April 23, 2007 10:06 AM
 To: flashcoders@chattyfig.figleaf.com
 Subject: Re: [Flashcoders] setInterval woes

 It's debugging 101.  Eliminate the obvious things first.  Calling
 clearInterval before setInterval is a preventative measure to protect
 you from unexpected behavior from accidental orphaning of intervals. I
 ALWAYS ALWAYS ALWAYS clearInterval before I setInterval regardless of
 whether it is the first time I'm setting it.  There is no reason not to
 do it and plenty of reason to do it.

 If you overwrite a reference to an interval with another interval, you
 orphan that interval which continues to run in the swf until you close
 the swf and you will never be able to stop it unless you knew the id of
 the interval in question.

 The reason I suggested it was because his code was not well written in
 that there was no protection that the interval would be overwritten
 since it was in a frame script.  If that frame ever played again you
 would have an interval orphaned and then doubled up.  From the
 description of the behavior he gave, that's exactly what it sounded like.




 Jordan Snyder wrote:
 Nevermind.  I'm obviously not communicating very well.  I'm extremely
 familiar with setInterval's and setTimeout's functionality.  What I'm
 trying to figure out is why Steven says to clearInterval first
 clearInterval can not be run without an argument, so I'm saying that
 if you haven't assigned setInterval to something, what are you going
 to call clearInterval on?  And why would you call it before it's even
 assigned to an actual interval?

 Cheers

 On 4/20/07, David Ngo [EMAIL PROTECTED] wrote:
 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

[Flashcoders] setInterval woes

2007-04-20 Thread Michael King

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, 6);

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


Re: [Flashcoders] setInterval woes

2007-04-20 Thread Alexander Farber

Are you missing a stop(); maybe?

On 4/20/07, Michael King [EMAIL PROTECTED] wrote:

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.


Regards
Alex

--
http://preferans.de
___
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


Re: [Flashcoders] setInterval woes

2007-04-20 Thread Jordan Snyder

I'm wondering the same as Alexander...perhaps it's something to do
with the timeline, or with other code that is happening around the
code you posted.  Is there anything else we should know?

You should also just put a trace at the top of the intervalLoop()
function to see if the problem may be with the server.  It is unlikely
but I've seen stranger.

It may not even be with the server, it may be with the XML object you
have there.  If you're deleting it in the first iteration but not
initializing it with 'var xmlData = new XML();, then where would it
be coming from after it's deleted?  That is, unless you're doing
something outside that function.

Hope that makes sense...I'm just now pouring my first cup of coffee
into my belly.

Cheers

On 4/20/07, Alexander Farber [EMAIL PROTECTED] wrote:

Are you missing a stop(); maybe?

On 4/20/07, Michael King [EMAIL PROTECTED] wrote:
 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.

Regards
Alex

--
http://preferans.de
___
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


RE: [Flashcoders] setInterval woes

2007-04-20 Thread David Ngo
What I would highly recommend is externalizing your interval and data
loading into a class. This way, you have the class handle its own state and
data, fire an event once it's loaded or reloaded data and have your movie
listen for that event. The class can then be instantiated just once at the
beginning of your movie. OR, use a Singleton to ensure a single
instantiation. I would probably advise against the Singleton approach for
your purposes, though.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael King
Sent: Friday, April 20, 2007 5:35 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] setInterval woes


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, 6);

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


Re: [Flashcoders] setInterval woes

2007-04-20 Thread Steven Sacks

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, 6);

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


Re: [Flashcoders] setInterval woes

2007-04-20 Thread Jordan Snyder

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, 6);

 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


RE: [Flashcoders] setInterval woes

2007-04-20 Thread David Ngo
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, 6);
 
  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


Re: [Flashcoders] setInterval woes

2007-04-20 Thread Jordan Snyder

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, 6);
 
  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

RE: [Flashcoders] setInterval woes

2007-04-20 Thread David Ngo
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, 6);
  
   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

Re: [Flashcoders] setInterval woes

2007-04-20 Thread Jordan Snyder

Nevermind.  I'm obviously not communicating very well.  I'm extremely
familiar with setInterval's and setTimeout's functionality.  What I'm
trying to figure out is why Steven says to clearInterval first
clearInterval can not be run without an argument, so I'm saying that
if you haven't assigned setInterval to something, what are you going
to call clearInterval on?  And why would you call it before it's even
assigned to an actual interval?

Cheers

On 4/20/07, David Ngo [EMAIL PROTECTED] wrote:

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, 6);
  
   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

Re: [Flashcoders] setInterval woes

2007-04-20 Thread robert

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, 6);
}

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, 6);

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