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

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


RE: [Flashcoders] setInterval creates tooltip, then kills it

2007-01-02 Thread Mendelsohn, Michael
Actually, that was the mystery, because -- of course -- my tooltip text
was *not* selectable, but the I-beam cursor showed up like an uninvited
guest.  Thanks for the tip!

- MM




 Is there any reason why you need your tooltip text to be selectable?
Selectable text gives you the i-beam cursor when you roll over it, and
the
i-beam interferes with button events. Try this...

myTextField.selectable = false;

___
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 creates tooltip, then kills it

2006-12-31 Thread me myself

Is there any reason why you need your tooltip text to be selectable?
Selectable text gives you the i-beam cursor when you roll over it, and the
i-beam interferes with button events. Try this...

myTextField.selectable = false;

On 12/29/06, Mendelsohn, Michael [EMAIL PROTECTED] wrote:


Thanks, Grégoire.  Your thought process seemed to work.  I also ended up
having to include a check for whether or not the tooltip MC was undefined
onEnterFrame.

- MM


class toolbarFunctions extends MovieClip {
private var tipID:Number;
function toolbarFunctions() {
}
function onRollOver():Void {
this.tipID = setInterval(this, displayTip, 1000);
}
function displayTip():Void {
// create text container...
// check to see if it was getting created again and again...
if (_root.tooltip == undefined) {
_root.createEmptyMovieClip(tooltip, 20);
_root.tooltip.createTextField(tip, 1, 0, 0, 100,
100);
_root.tooltip.tip.text = tooltip;
// make text follow mouse...
_root.tooltip.onEnterFrame = function():Void  {
var coord:Object = {xx:_root._xmouse,
yy:_root._ymouse};
this._x = coord.xx;
this._y = coord.yy;
};
clearInterval(this.tipID);
}
}
}

___
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 creates tooltip, then kills it

2006-12-29 Thread Grégoire Divaret

The issue is not the interval but the rollOver. when you move your
mouse, the tooltip MC is not immediately moved and you roll over it (so
you got the
I-beam cursor) when it is moved the rollOver function is called again
and the interval is launched again.


You only have to put _root.tooltip.onMouseMove  instead of
_root.tooltip.onEnterFrame and it will be ok (until the user don't move
the mouse too fast)


Mendelsohn, Michael a écrit :

Hi list...

//Happy new year!
I have a tooltip function that makes a tooltip MC follow the mouse over
when rolling over another MC, but it gets blown out after two frames,
and the mouse turns to an I-beam cursor.  I can't figure out why.  I
*don't* think it's a setInterval issue, but I might be wrong.
Curiously, the onEnterFrame function works only when I *don't* set the
_x property of the tooltip MC.

Any feedback is appreciated.
- Michael M.



class toolbarFunctions extends MovieClip {
private var tipID:Number;
function toolbarFunctions() {
}
function onRollOver():Void {
this.tipID = setInterval(this, displayTip, 1000);
}
function displayTip():Void {
// create text container...
_root.createEmptyMovieClip(tooltip, 20);
_root.tooltip.createTextField(tip, 1, 0, 0, 100, 100);
_root.tooltip.tip.text = tooltip;
// make text follow mouse...
_root.tooltip.onEnterFrame = function():Void  {
var coord:Object = {xx:_root._xmouse,
yy:_root._ymouse};
this._x = coord.xx;
this._y = coord.yy;
//this._x = _root._xmouse;
//this._y = _root._ymouse;
//_root.tooltip._x = _root._xmouse;
};
clearInterval(this.tipID);
}
}

___
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






_
Live.com: le nouveau moteur de recherche par Messenger! 
http://www.windowslive.fr/livecom/


___
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 creates tooltip, then kills it

2006-12-29 Thread Mendelsohn, Michael
Thanks, Grégoire.  Your thought process seemed to work.  I also ended up having 
to include a check for whether or not the tooltip MC was undefined 
onEnterFrame.   

- MM


class toolbarFunctions extends MovieClip {
private var tipID:Number;
function toolbarFunctions() {
}
function onRollOver():Void {
this.tipID = setInterval(this, displayTip, 1000);
}
function displayTip():Void {
// create text container...
// check to see if it was getting created again and again...
if (_root.tooltip == undefined) {
_root.createEmptyMovieClip(tooltip, 20);
_root.tooltip.createTextField(tip, 1, 0, 0, 100, 100);
_root.tooltip.tip.text = tooltip;
// make text follow mouse...
_root.tooltip.onEnterFrame = function():Void  {
var coord:Object = {xx:_root._xmouse, 
yy:_root._ymouse};
this._x = coord.xx;
this._y = coord.yy;
};
clearInterval(this.tipID);
}
}
}

___
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 and IE ...

2006-11-30 Thread Ben Smeets
Nope, using them all the time, but no problems whatsoever. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stephen
Ford
Sent: donderdag 30 november 2006 10:00
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] setInterval and IE ...

Has anyone ever experienced any problems with using setIntervals in IE,
both with window mode of transparent and without any window mode
(normal) ?
 
Thanks,
Stephen.___
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 and IE ...

2006-11-30 Thread Sander van Surksum
What kind of problems do you have?


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ben
Smeets
Sent: donderdag 30 november 2006 10:40
To: Flashcoders mailing list
Subject: RE: [Flashcoders] setInterval and IE ...


Nope, using them all the time, but no problems whatsoever. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stephen
Ford
Sent: donderdag 30 november 2006 10:00
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] setInterval and IE ...

Has anyone ever experienced any problems with using setIntervals in IE,
both with window mode of transparent and without any window mode
(normal) ?
 
Thanks,
Stephen.___
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
___
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 and IE ...

2006-11-30 Thread Силин В . Е .
Hi!

I recently found what actions made by setInterval's functions are occurs
slowly in a swf that embedded on a page (browsing in IE) rather in testing
player. 

Best regards, Vadim

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sander van
Surksum
Sent: Thursday, November 30, 2006 2:48 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] setInterval and IE ...

What kind of problems do you have?


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ben
Smeets
Sent: donderdag 30 november 2006 10:40
To: Flashcoders mailing list
Subject: RE: [Flashcoders] setInterval and IE ...


Nope, using them all the time, but no problems whatsoever. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stephen
Ford
Sent: donderdag 30 november 2006 10:00
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] setInterval and IE ...

Has anyone ever experienced any problems with using setIntervals in IE,
both with window mode of transparent and without any window mode
(normal) ?
 
Thanks,
Stephen.___
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
___
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

2006-07-26 Thread jim
I don't think you should be using quotes around the function name.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of keitai guy
Sent: 26 July 2006 21:10
To: Flashcoders mailing list
Subject: [Flashcoders] setInterval

hi list -

i have some weirdness with setInterval, wondering if someone could
suggest solutions?

code:

var intId:Number;
img = new ImageLoader( imgUrl, tgtMc );
intId = setInterval(img, checkLoading, 100 ); // doesnt
work
intId = setInterval( checkLoadingFunc, 100, img); //
doesnt work
trace(setInt= + intId);


however, all i get in all cases is undefined for the intId .

the object is getting created fine...

i also tried setting it within the class itself, still with same problem.
the function is defined before this code in question, in case its a
compiler/precedence issue. but no effect.

have used intervals often before, so maybe there is some weird thing i
never ran afoul of before...

FL8/AS2

thanks!

/dc
___
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

2006-07-26 Thread Michael Bedar
The first form is fine, but you are trying to address a function  
called checkLoading inside an instance of ImageLoader, which does not  
exist..


if checkLoading is on the root level, then you would say:

intId = setInterval(_root, checkLoading, 100 ); 

The second form is incorrect, no quotes there..

Why not just use the built in onProgress event in ImageLoader?

mike




On Jul 26, 2006, at 4:10 PM, keitai guy wrote:


hi list -

i have some weirdness with setInterval, wondering if someone could
suggest solutions?

code:

var intId:Number;
img = new ImageLoader( imgUrl, tgtMc );
intId = setInterval(img, checkLoading, 100 );   // doesnt 
work
intId = setInterval( checkLoadingFunc, 100, img);   // doesnt 
work
trace(setInt= + intId);


however, all i get in all cases is undefined for the intId .

the object is getting created fine...

i also tried setting it within the class itself, still with same  
problem.

the function is defined before this code in question, in case its a
compiler/precedence issue. but no effect.

have used intervals often before, so maybe there is some weird thing i
never ran afoul of before...

FL8/AS2

thanks!

/dc
___
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

2006-07-26 Thread keitai guy

hi -

thanks for the help ...


if checkLoading is on the root level, then you would say:
intId = setInterval(_root, checkLoading, 100 );


great, this works. now i'd like to try and get it working inside an object...


The second form is incorrect, no quotes there..

intId = setInterval( this, checkLoading, 100 ); // doesnt work

so - this is wrong?


Why not just use the built in onProgress event in ImageLoader?

good point, but i wanted to write my own stuff first to know whats going on...

/dc
___
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

2006-07-26 Thread Michael Bedar
setInterval either takes a function, or an object with the name of a  
function that object contains as a string, hence the 2 ways of using it





On Jul 26, 2006, at 5:16 PM, keitai guy wrote:


hi -

thanks for the help ...


if checkLoading is on the root level, then you would say:
intId = setInterval(_root, checkLoading, 100 );


great, this works. now i'd like to try and get it working inside an  
object...



The second form is incorrect, no quotes there..

intId = setInterval( this, checkLoading, 100 ); // doesnt work

so - this is wrong?


Why not just use the built in onProgress event in ImageLoader?
good point, but i wanted to write my own stuff first to know whats  
going on...


/dc
___
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 and loadMovie

2006-07-14 Thread Flash Mel

Thanks guys, got it working!

Cheers,

fM.



On 7/10/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:


You orphaned a running interval.  You need to make sure you
clearInterval first.  You could put it in the onUnload of your loaded
movie, or you could clear the interval in that swf just before you
loadMovie.

BLITZ | Steven Sacks - 310-551-0200 x209


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:flashcoders-
 [EMAIL PROTECTED] On Behalf Of Flash Mel
 Sent: Sunday, July 09, 2006 8:04 PM
 To: Flashcoders mailing list
 Subject: [Flashcoders] setInterval and loadMovie

 Evening,

 I'm having a brainfart here.  I have a movie that loads separate .swfs
 into a clip called holdGallery_mc.  All of the .swfs are simply
 different slideshows (reads from xml, images files on server,
 preloader for each image, pan image vert or horz depending on size,
 etc.).  Anyway, the core for all the slideshows to work is a
 setInterval script reStartSlides = setInterval(startSlides, 4000);

 Here is my problem, when loading the the .swfs into the main movie,
 the first one naturally, is ok.  But when I try loading another .swf
 to  replace the current on, the old .swf is gone but its interval is
 still alive and kicking.

 What, what?!

 What is happening?
 ___
 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


___
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 and loadMovie

2006-07-14 Thread Tony Trapp
Hey Steven just wanted to tell ya I miss the old site you guys had back
about 4 years ago and also the update you guys did.

Very good stuff!!!

Tony Trapp

- Original Message - 
From: Flash Mel [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Thursday, July 13, 2006 10:58 AM
Subject: Re: [Flashcoders] setInterval and loadMovie


 Thanks guys, got it working!

 Cheers,

 fM.



 On 7/10/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:
 
  You orphaned a running interval.  You need to make sure you
  clearInterval first.  You could put it in the onUnload of your loaded
  movie, or you could clear the interval in that swf just before you
  loadMovie.
 
  BLITZ | Steven Sacks - 310-551-0200 x209
 
 
   -Original Message-
   From: [EMAIL PROTECTED] [mailto:flashcoders-
   [EMAIL PROTECTED] On Behalf Of Flash Mel
   Sent: Sunday, July 09, 2006 8:04 PM
   To: Flashcoders mailing list
   Subject: [Flashcoders] setInterval and loadMovie
  
   Evening,
  
   I'm having a brainfart here.  I have a movie that loads separate .swfs
   into a clip called holdGallery_mc.  All of the .swfs are simply
   different slideshows (reads from xml, images files on server,
   preloader for each image, pan image vert or horz depending on size,
   etc.).  Anyway, the core for all the slideshows to work is a
   setInterval script reStartSlides = setInterval(startSlides, 4000);
  
   Here is my problem, when loading the the .swfs into the main movie,
   the first one naturally, is ok.  But when I try loading another .swf
   to  replace the current on, the old .swf is gone but its interval is
   still alive and kicking.
  
   What, what?!
  
   What is happening?
   ___
   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
 
 ___
 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 and loadMovie

2006-07-09 Thread Keith Reinfeld
Use clearInterval(reStartSlides); when you want the interval to stop.


-Keith 
http://home.mn.rr.com/keithreinfeld 
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Flash Mel
Sent: Sunday, July 09, 2006 10:04 PM
To: Flashcoders mailing list
Subject: [Flashcoders] setInterval and loadMovie

Evening,

I'm having a brainfart here.  I have a movie that loads separate .swfs
into a clip called holdGallery_mc.  All of the .swfs are simply
different slideshows (reads from xml, images files on server,
preloader for each image, pan image vert or horz depending on size,
etc.).  Anyway, the core for all the slideshows to work is a
setInterval script reStartSlides = setInterval(startSlides, 4000);

Here is my problem, when loading the the .swfs into the main movie,
the first one naturally, is ok.  But when I try loading another .swf
to  replace the current on, the old .swf is gone but its interval is
still alive and kicking.

What, what?!

What is happening?
___
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 and loadMovie

2006-07-09 Thread Zeh Fernando

Here is my problem, when loading the the .swfs into the main movie,
the first one naturally, is ok.  But when I try loading another .swf
to  replace the current on, the old .swf is gone but its interval is
still alive and kicking.
What, what?!
What is happening?


setIntervals continue to be running even when their original movieclip is 
deleted, unloaded, or otherwise removed. It exists on some kind of global 
scope.


Always clearInterval your intervals. It's the only way to make them stop.


- Zeh 


___
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 vs. onEnterFrame

2006-05-24 Thread Tom Lee
Yes, it would be more processor and memory intensive to use empty movieclips
for sync.  The reason for this is that a movieclip is a special kind of
object that has a ton of its own built-in methods and properties, none of
which you need for timing purposes.

Managing the interval id's shouldn't be a problem - you should be able to
scope them to one object whose purpose is to keep track of them all.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rifled
Cloaca
Sent: Wednesday, May 24, 2006 5:03 PM
To: Flashcoders mailing list
Subject: [Flashcoders] SetInterval vs. onEnterFrame

Flashcoders,

I'm building a modular system that contains various programmatic animations
within seperate modules, coordinated by a central wrapper class.  I've opted
to use empty movieclips with onEnterFrame functions to manage timing in
animations and presentation playback, as opposed to setInterval.  Reason
being is that I don't want to have to worry about scoping my intervals, and
most of all, losing track of intervals and eventually having them stack up,
interfere with eachother, and cause memory leaks.

Question is, isn't it more processor intensive to use a series of
onEnterFrames like this?  Can anyone think of any other cons to the method
I've chosen?

Thanks in advance!
-g
___
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 vs. onEnterFrame

2006-05-24 Thread Adam Pasztory

I've found anecdotally the onEnterFrames are less CPU intensive than a
setInterval running at a similar rate.

The cons of setInterval are worth noting, but if you're using a good OOP
code design, and you're strict about tracking your interval IDs, then you
don't have to be too afraid of setInterval.  I usually define a single
member variable in a class to track a particular interval.  Any time I want
to call set interval, I first make sure the interval is cleared.

...
if(this.intervalId)
  clearInterval(this.intervalId);
this.intervalId = setInterval(this, someMethod, time);

Seems to work pretty well.

There is also a gotcha related to onEnterFrame that's worth mentioning: A
MovieClip can only have a single onEnterFrame handler, so when you assign an
event handler to some MovieClip you'd better make sure it doesn't already
have a  different onEnterFrame already assigned to it.  I've run into this
kind of thing when working with animations from artists who like to put a
lot of Actionscript functionality into their MovieClips.

-Adam

On 5/24/06, Rifled Cloaca [EMAIL PROTECTED] wrote:


Flashcoders,

I'm building a modular system that contains various programmatic
animations
within seperate modules, coordinated by a central wrapper class.  I've
opted
to use empty movieclips with onEnterFrame functions to manage timing in
animations and presentation playback, as opposed to setInterval.  Reason
being is that I don't want to have to worry about scoping my intervals,
and
most of all, losing track of intervals and eventually having them stack
up,
interfere with eachother, and cause memory leaks.

Question is, isn't it more processor intensive to use a series of
onEnterFrames like this?  Can anyone think of any other cons to the method
I've chosen?

Thanks in advance!
-g
___
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 vs. onEnterFrame

2006-05-24 Thread Tyler Wright

setInterval's use up next to nothing on processor, even if you have 20 of
them going. I find that the best judgement of which to use is the task at
hand.

Because framerate is for animation, I find it best to use onEnterFrame when
doing coded animation. Flash will cause an automatic screen redraw each
frame and because the onEnterFrame executes precisely before this redraw
it's the perfect chance to make display changes and scripted tweens. To keep
processor to a minimum it is good to use only one onEnterFrame because many
of them will make a processor difference. The way to do this is set up an
enterFrameBroadcaster ... basically have one onEnterFrame running and
dispatching an enterFrame event each cycle. Then many objects can listen.
This was first used by Robert Penner I believe and is built in to the
Macromedia tween classes. I also have a version if you can't find one
suitable.

To have a smooth animation using setInterval you must call
updateAfterEvent() in the interval, forcing a redraw. Each additional screen
redraw you make is additional processor - the framerate redraw will happen
regardless. The best time to use setInterval is when you want to achieve a
specific interval of time. For example, when the user clicks a scrollbar
arrow it shouldn't move faster and slower based on the framerate a designer
sets the movie at. It will always depends on your context and the behavior
you want.

Tyler



On 5/24/06, Adam Pasztory [EMAIL PROTECTED] wrote:


I've found anecdotally the onEnterFrames are less CPU intensive than a
setInterval running at a similar rate.

The cons of setInterval are worth noting, but if you're using a good OOP
code design, and you're strict about tracking your interval IDs, then you
don't have to be too afraid of setInterval.  I usually define a single
member variable in a class to track a particular interval.  Any time I
want
to call set interval, I first make sure the interval is cleared.

...
if(this.intervalId)
   clearInterval(this.intervalId);
this.intervalId = setInterval(this, someMethod, time);

Seems to work pretty well.

There is also a gotcha related to onEnterFrame that's worth mentioning: A
MovieClip can only have a single onEnterFrame handler, so when you assign
an
event handler to some MovieClip you'd better make sure it doesn't already
have a  different onEnterFrame already assigned to it.  I've run into this
kind of thing when working with animations from artists who like to put a
lot of Actionscript functionality into their MovieClips.

-Adam

On 5/24/06, Rifled Cloaca [EMAIL PROTECTED] wrote:

 Flashcoders,

 I'm building a modular system that contains various programmatic
 animations
 within seperate modules, coordinated by a central wrapper class.  I've
 opted
 to use empty movieclips with onEnterFrame functions to manage timing in
 animations and presentation playback, as opposed to setInterval.  Reason
 being is that I don't want to have to worry about scoping my intervals,
 and
 most of all, losing track of intervals and eventually having them stack
 up,
 interfere with eachother, and cause memory leaks.

 Question is, isn't it more processor intensive to use a series of
 onEnterFrames like this?  Can anyone think of any other cons to the
method
 I've chosen?

 Thanks in advance!
 -g
 ___
 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


___
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 intervalID type?

2006-04-19 Thread Michael Trim
what type of object is the intervalId that
gets returned from setInterval()?  

Number
___
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 intervalID type?

2006-04-19 Thread Dimitrios Bendilas

It's a Number

Regards,
Dimitrios Bendilas

- Original Message - 
From: Merrill, Jason [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, April 19, 2006 7:08 PM
Subject: [Flashcoders] setInterval intervalID type?


May be a dumb question, but what type of object is the intervalId that
gets returned from setInterval()?

I thought I could declare it a generic object, but no:

var checkId:Object;
checkId = setInterval(myFunction, 100);
clearInterval(checkId);//The compiler throws a type mismatch error on
this
 //if I declare the var as an object in (line
1). Without
 //any type declaration on the var, it works
fine.

Not a show-stopper, just asking more out of curiosity.   Thanks,

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com




NOTICE:
This message is for the designated recipient only and may contain privileged 
or confidential information. If you have received it in error, please notify 
the sender immediately and delete the original. Any other use of this e-mail 
by you is prohibited.

___
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 intervalID type?

2006-04-19 Thread Merrill, Jason
Thanks Geoff and Michael - I knew it was a dumb question.  And probably
real easy to find in the help docs too.  Sorry for the bandwidth :)

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Geoff Stearns
Sent: Wednesday, April 19, 2006 12:11 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] setInterval intervalID type?

it returns a number.


On Apr 19, 2006, at 12:08 PM, Merrill, Jason wrote:

 May be a dumb question, but what type of object is the intervalId
that
 gets returned from setInterval()?

 I thought I could declare it a generic object, but no:

 var checkId:Object;
 checkId = setInterval(myFunction, 100);
 clearInterval(checkId);//The compiler throws a type mismatch error
on
 this
   //if I declare the var as an object in (line
 1). Without
   //any type declaration on the var, it works
 fine.

 Not a show-stopper, just asking more out of curiosity.   Thanks,

 Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com




 NOTICE:
 This message is for the designated recipient only and may contain
 privileged or confidential information. If you have received it in
 error, please notify the sender immediately and delete the
 original. Any other use of this e-mail by you is prohibited.
 ___
 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
___
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 intervalID type?

2006-04-19 Thread Julian 'Julik' Tarkhanov


On 19-apr-2006, at 18:08, Merrill, Jason wrote:


May be a dumb question, but what type of object is the intervalId that
gets returned from setInterval()?


It's a Number.


--
Julian 'Julik' Tarkhanov
me at julik.nl



___
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 inside created Clip

2006-02-24 Thread Byron Canfield
newClip.intervalid = setInterval(newClip.doSomething, 200);


-- 
Byron Barn Canfield


 Hey All,

 I'm looping through a structure adding movieclips along the way for each
 element. I need to setup a separate interval inside each new clip. If I
 call
 the function directly, I need this to be constantly updating without an
 onEnterFrame.



 _root.work.createEmptyMovieClip( newName, vItemCount );
 //
 var newClip = _root.work[newName];
 //
 // this function redraws the line
 newClip.doSomething = function(){
 // {.}
 }
 // I've tried all of the following
 // newClip.intervalid = setInterval(this, doSomething, 200);
 // newClip.intervalid = newClip.setInterval(doSomething, 200);
 // newClip.intervalid = setInterval(newClip, doSomething, 200);

 Any insight or help is appreciated.


 Cheers,

 !k


___
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 inside created Clip

2006-02-24 Thread Nick Gerig

maybe:

newClip.intervalid = setInterval(newClip,doSomething, 200);



Kevin Aebig wrote:


Nope... didn't work. This is weird because a call to newClip.doSomething()
works exactly as expected... 


Cheers,

Kevin

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Byron
Canfield
Sent: February 24, 2006 11:01 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] setInterval inside created Clip

newClip.intervalid = setInterval(newClip.doSomething, 200);


 






___
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 inside created Clip

2006-02-24 Thread Ettwein, Josh
How about... Note I added some dummy values to vars to get it to work in
my environment. The last param is optional, but I figured I'd throw that
in there in case you weren't aware of that one.

var rootRef =_root;
var vItemCount =1;
var newName =test;

rootRef.work.createEmptyMovieClip(newName, vItemCount);
var newClip = rootRef.work[newName];

newClip.doSomething = function(arg){
trace(I just did something... yay! +arg);
}

var intID =setInterval( newClip, doSomething, 1000, say this ); 

HTH,

Josh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin
Aebig
Sent: Friday, February 24, 2006 9:27 AM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] setInterval inside created Clip

Nope... didn't work. This is weird because a call to
newClip.doSomething() works exactly as expected... 

Cheers,

Kevin

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Byron
Canfield
Sent: February 24, 2006 11:01 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] setInterval inside created Clip

newClip.intervalid = setInterval(newClip.doSomething, 200);


--
Byron Barn Canfield


 Hey All,

 I'm looping through a structure adding movieclips along the way for
each
 element. I need to setup a separate interval inside each new clip. If
I
 call
 the function directly, I need this to be constantly updating without
an
 onEnterFrame.



 _root.work.createEmptyMovieClip( newName, vItemCount );
 //
 var newClip = _root.work[newName];
 //
 // this function redraws the line
 newClip.doSomething = function(){
 // {.}
 }
 // I've tried all of the following
 // newClip.intervalid = setInterval(this, doSomething, 200);
 // newClip.intervalid = newClip.setInterval(doSomething, 200);
 // newClip.intervalid = setInterval(newClip, doSomething, 200);

 Any insight or help is appreciated.


 Cheers,

 !k


___
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
___
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 inside created Clip

2006-02-24 Thread Kevin Aebig
Nope... still won't go. 

I actually decided to do a little test and when I set the function to be
onEnterFrame instead of doSomething, it performs well. The only problem is
that I'm unsure how many clips could be running at the same time and I don't
want a performance hit...

!K

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nick Gerig
Sent: February 24, 2006 12:10 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] setInterval inside created Clip

maybe:

newClip.intervalid = setInterval(newClip,doSomething, 200);



Kevin Aebig wrote:

Nope... didn't work. This is weird because a call to newClip.doSomething()
works exactly as expected... 

Cheers,

Kevin

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Byron
Canfield
Sent: February 24, 2006 11:01 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] setInterval inside created Clip

newClip.intervalid = setInterval(newClip.doSomething, 200);


  





___
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 inside created Clip

2006-02-24 Thread eric dolecki
var vItemCount:Number = 2;
var newName = test;

this.createEmptyMovieClip(work, 1);
work.createEmptyMovieClip(newName, vItemCount);

var newClip = work[newName];

newClip.doSomething = function(arg){
   trace(I just did something... yay! +arg);
}

var intID =setInterval( newClip, doSomething, 1000, say this );



On 2/24/06, Kevin Aebig [EMAIL PROTECTED] wrote:

 I gave it a try and it didn't fire. I even added a trace statement to make
 sure that the function wasn't firing and not functioning properly.

 !k

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Ettwein,
 Josh
 Sent: February 24, 2006 12:29 PM
 To: Flashcoders mailing list
 Subject: RE: [Flashcoders] setInterval inside created Clip

 How about... Note I added some dummy values to vars to get it to work in
 my environment. The last param is optional, but I figured I'd throw that
 in there in case you weren't aware of that one.

 var rootRef =_root;
 var vItemCount =1;
 var newName =test;

 rootRef.work.createEmptyMovieClip(newName, vItemCount);
 var newClip = rootRef.work[newName];

 newClip.doSomething = function(arg){
 trace(I just did something... yay! +arg);
 }

 var intID =setInterval( newClip, doSomething, 1000, say this );

 HTH,

 Josh

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Kevin
 Aebig
 Sent: Friday, February 24, 2006 9:27 AM
 To: 'Flashcoders mailing list'
 Subject: RE: [Flashcoders] setInterval inside created Clip

 Nope... didn't work. This is weird because a call to
 newClip.doSomething() works exactly as expected...

 Cheers,

 Kevin

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Byron
 Canfield
 Sent: February 24, 2006 11:01 AM
 To: flashcoders@chattyfig.figleaf.com
 Subject: Re: [Flashcoders] setInterval inside created Clip

 newClip.intervalid = setInterval(newClip.doSomething, 200);


 --
 Byron Barn Canfield


  Hey All,
 
  I'm looping through a structure adding movieclips along the way for
 each
  element. I need to setup a separate interval inside each new clip. If
 I
  call
  the function directly, I need this to be constantly updating without
 an
  onEnterFrame.
 
 
 
  _root.work.createEmptyMovieClip( newName, vItemCount );
  //
  var newClip = _root.work[newName];
  //
  // this function redraws the line
  newClip.doSomething = function(){
  // {.}
  }
  // I've tried all of the following
  // newClip.intervalid = setInterval(this, doSomething, 200);
  // newClip.intervalid = newClip.setInterval(doSomething, 200);
  // newClip.intervalid = setInterval(newClip, doSomething, 200);
 
  Any insight or help is appreciated.
 
 
  Cheers,
 
  !k


 ___
 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
 ___
 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

___
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 inside created Clip

2006-02-24 Thread jim
Try mx.utils.Delegate might be the scope.

Jim

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin
Aebig
Sent: 24 February 2006 19:59
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] setInterval inside created Clip

I gave it a try and it didn't fire. I even added a trace statement to
make
sure that the function wasn't firing and not functioning properly.

!k

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ettwein,
Josh
Sent: February 24, 2006 12:29 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] setInterval inside created Clip

How about... Note I added some dummy values to vars to get it to work in
my environment. The last param is optional, but I figured I'd throw that
in there in case you weren't aware of that one.

var rootRef =_root;
var vItemCount =1;
var newName =test;

rootRef.work.createEmptyMovieClip(newName, vItemCount);
var newClip = rootRef.work[newName];

newClip.doSomething = function(arg){
trace(I just did something... yay! +arg);
}

var intID =setInterval( newClip, doSomething, 1000, say this ); 

HTH,

Josh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin
Aebig
Sent: Friday, February 24, 2006 9:27 AM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] setInterval inside created Clip

Nope... didn't work. This is weird because a call to
newClip.doSomething() works exactly as expected... 

Cheers,

Kevin

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Byron
Canfield
Sent: February 24, 2006 11:01 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] setInterval inside created Clip

newClip.intervalid = setInterval(newClip.doSomething, 200);


--
Byron Barn Canfield


 Hey All,

 I'm looping through a structure adding movieclips along the way for
each
 element. I need to setup a separate interval inside each new clip. If
I
 call
 the function directly, I need this to be constantly updating without
an
 onEnterFrame.



 _root.work.createEmptyMovieClip( newName, vItemCount );
 //
 var newClip = _root.work[newName];
 //
 // this function redraws the line
 newClip.doSomething = function(){
 // {.}
 }
 // I've tried all of the following
 // newClip.intervalid = setInterval(this, doSomething, 200);
 // newClip.intervalid = newClip.setInterval(doSomething, 200);
 // newClip.intervalid = setInterval(newClip, doSomething, 200);

 Any insight or help is appreciated.


 Cheers,

 !k


___
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
___
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

___
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 inside created Clip

2006-02-24 Thread jim
Give me more of the code, what exactly are you trying to do? Can you
keep all of the crated mc's in an array  have a function that loops
through them  changes what you need? 

Jim

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin
Aebig
Sent: 24 February 2006 20:00
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] setInterval inside created Clip

Nope... still won't go. 

I actually decided to do a little test and when I set the function to be
onEnterFrame instead of doSomething, it performs well. The only problem
is
that I'm unsure how many clips could be running at the same time and I
don't
want a performance hit...

!K

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nick
Gerig
Sent: February 24, 2006 12:10 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] setInterval inside created Clip

maybe:

newClip.intervalid = setInterval(newClip,doSomething, 200);



Kevin Aebig wrote:

Nope... didn't work. This is weird because a call to
newClip.doSomething()
works exactly as expected... 

Cheers,

Kevin

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Byron
Canfield
Sent: February 24, 2006 11:01 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] setInterval inside created Clip

newClip.intervalid = setInterval(newClip.doSomething, 200);


  





___
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

___
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 inside created Clip

2006-02-24 Thread eric dolecki
my code fires off the func every sec here... weird.

On 2/24/06, Kevin Aebig [EMAIL PROTECTED] wrote:

 Nope... still won't go.

 I actually decided to do a little test and when I set the function to be
 onEnterFrame instead of doSomething, it performs well. The only problem is
 that I'm unsure how many clips could be running at the same time and I
 don't
 want a performance hit...

 !K

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Nick Gerig
 Sent: February 24, 2006 12:10 PM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] setInterval inside created Clip

 maybe:

 newClip.intervalid = setInterval(newClip,doSomething, 200);



 Kevin Aebig wrote:

 Nope... didn't work. This is weird because a call to newClip.doSomething
 ()
 works exactly as expected...
 
 Cheers,
 
 Kevin
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Byron
 Canfield
 Sent: February 24, 2006 11:01 AM
 To: flashcoders@chattyfig.figleaf.com
 Subject: Re: [Flashcoders] setInterval inside created Clip
 
 newClip.intervalid = setInterval(newClip.doSomething, 200);
 
 
 
 




 ___
 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

___
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 inside created Clip

2006-02-24 Thread Kevin Aebig
+=e.d=+ you bugger...

Ok.. for some odd reason, that works. 

This doesn't:
newClip.intervalid = setInterval( newClip, doSomething, 1000 );

But this does:
var intID =setInterval( newClip, doSomething, 1000 );

Really friggin' weird. Thanks for all the suggestions guys...

Cheers,

!k

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of eric dolecki
Sent: February 24, 2006 2:04 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] setInterval inside created Clip

var vItemCount:Number = 2;
var newName = test;

this.createEmptyMovieClip(work, 1);
work.createEmptyMovieClip(newName, vItemCount);

var newClip = work[newName];

newClip.doSomething = function(arg){
   trace(I just did something... yay! +arg);
}

var intID =setInterval( newClip, doSomething, 1000, say this );



On 2/24/06, Kevin Aebig [EMAIL PROTECTED] wrote:

 I gave it a try and it didn't fire. I even added a trace statement to make
 sure that the function wasn't firing and not functioning properly.

 !k

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Ettwein,
 Josh
 Sent: February 24, 2006 12:29 PM
 To: Flashcoders mailing list
 Subject: RE: [Flashcoders] setInterval inside created Clip

 How about... Note I added some dummy values to vars to get it to work in
 my environment. The last param is optional, but I figured I'd throw that
 in there in case you weren't aware of that one.

 var rootRef =_root;
 var vItemCount =1;
 var newName =test;

 rootRef.work.createEmptyMovieClip(newName, vItemCount);
 var newClip = rootRef.work[newName];

 newClip.doSomething = function(arg){
 trace(I just did something... yay! +arg);
 }

 var intID =setInterval( newClip, doSomething, 1000, say this );

 HTH,

 Josh

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Kevin
 Aebig
 Sent: Friday, February 24, 2006 9:27 AM
 To: 'Flashcoders mailing list'
 Subject: RE: [Flashcoders] setInterval inside created Clip

 Nope... didn't work. This is weird because a call to
 newClip.doSomething() works exactly as expected...

 Cheers,

 Kevin

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Byron
 Canfield
 Sent: February 24, 2006 11:01 AM
 To: flashcoders@chattyfig.figleaf.com
 Subject: Re: [Flashcoders] setInterval inside created Clip

 newClip.intervalid = setInterval(newClip.doSomething, 200);


 --
 Byron Barn Canfield


  Hey All,
 
  I'm looping through a structure adding movieclips along the way for
 each
  element. I need to setup a separate interval inside each new clip. If
 I
  call
  the function directly, I need this to be constantly updating without
 an
  onEnterFrame.
 
 
 
  _root.work.createEmptyMovieClip( newName, vItemCount );
  //
  var newClip = _root.work[newName];
  //
  // this function redraws the line
  newClip.doSomething = function(){
  // {.}
  }
  // I've tried all of the following
  // newClip.intervalid = setInterval(this, doSomething, 200);
  // newClip.intervalid = newClip.setInterval(doSomething, 200);
  // newClip.intervalid = setInterval(newClip, doSomething, 200);
 
  Any insight or help is appreciated.
 
 
  Cheers,
 
  !k


 ___
 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
 ___
 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

___
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 interfering with Sound

2006-01-27 Thread Ramon Tayag
Try commenting out the line that makes the light flash - but still
fire the interval.  If it doesn't interfere anymore, then that means
it's the drawing of the light that interferes.

On 1/28/06, Jack H [EMAIL PROTECTED] wrote:
 Has anyone experienced an interval stopping sounds?

 I made a basketball game where I have an interval
 which creates random flashes of light on the stage.
 When the user misses or gets a ball in, a sound is
 initiated, which is totally unrelated to the interval.
 Gradually the flashes of light gets faster and faster
 -- in other words, I first clear the flash interval
 and then reset the interval with a smaller millisecond
 value. As this value approaches 1 millisecond (I know,
 that's pretty fast), this interval starts interfering
 with the sounds, which are unrelated to this interval.
 The sounds would be initiated by the user's shooting
 of the ball and almost as soon as the sound starts, it
 prematurely stops.

 What's happening here? Why is this happening?

 thanks in advance!

 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--
Ramon Miguel M. Tayag
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] SetInterval Magic

2006-01-11 Thread Sönke Rohde
Hi,
This is a scope-issue. Try

import mx.utils.Delegate
...
setInterval(Delegate.create(this, func), 2000);

Cheers,
Sönke

 Hi Coders,
 
   In following code, I am creating a new dynamic movie clip (in
 function N1 of script object) and associating the handler for unload
 event. Next I am deleting the same movie clip in function N3 of script
 object. But if we are calling the function N3 through setInterval
 function, movieclip unload event is not called.
 
 Now if we are calling the same function N3 directly without 
 setInterval,
 unload event will be called.
 
 Someone please tell me what is happening here?
 
  
 
 script = new Object();
 
 Delay = new Object();
 
  
 
 // Delay Object
 
 Delay.delay = function(obj, func)
 
 {
 
   this.mObj = obj;
 
   this.mFunc = func;
 
   // Calling function after an interval of 2 seconds.
 
   setInterval(this.func, 2000, this);
 
 }
 
  
 
 Delay.func = function(obj)
 
 {
 
   var temp = obj;
 
   // Calling function N3 of class script.
 
   temp.mObj[temp.mFunc]();
 
 }
 
  
 
 // Script Object
 
 script.N1 = function()
 
 {
 
   // Creating a new movie clip.
 
   _root.createEmptyMovieClip(Dhiraj, 1);
 
  
 
 // Associating unload event with it.
 
   _root.Dhiraj.onUnload = function()
 
   {
 
 trace(Dhiraj Unload);
 
   }
 
  
 
   // Storing the movie clip instance in member variable.
 
   this.mMC = _root.Dhiraj;
 
  
 
   // Calling next function of script.
 
   this.N2();
 
 }
 
  
 
 script.N2 = function() 
 
 {
 
 // Calling N3 after some delay.
 
   Delay.delay(this, N3);
 
 }
 
  
 
 script.N3 = function()
 
 {
 
   this.mMC.removeMovieClip();
 
 }
 
  
 
 script.N1();  // Calling first function of script.
 
  
 
 Regards:
 
 Dhiraj
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] SetInterval Magic

2006-01-11 Thread Alias
Hi guys,

It's important to realise that setInterval has two different ways to call it.

The first, and most commonly used, is this:

setInterval(functionReference:Function, interval:Number,
[param1:Object, param2, ..., paramN]) : Number

The second, which is less well known, but substantially more reliable, is this:

setInterval(objectReference:Object, methodName:String,
interval:Number, [param1:Object, param2, ..., paramN]) : Number



Although the first example will work, the function will execute in the
wrong scope.
The second, however, because it allows you to specify the scope in
which it executes, is far more reliable.

For example, if I'm inside a class, and want to call a public method
of that same class every 1000 ms, I would use:

setInterval(this,myFunction,1000);

What's important to understand here is the difference between passing
the name of the function, and *the function itself* - which is what's
happening in the first example. There has been a lot of confusion
about this over the past few years, mostly due to ambiguous
documentation. Have a look here for a well written piece of
documentation on the subject:

http://livedocs.macromedia.com/flash/8/main/1766.html

Hope this helps,
Alias


On 1/11/06, Sönke Rohde [EMAIL PROTECTED] wrote:
 Hi,
 This is a scope-issue. Try

 import mx.utils.Delegate
 ...
 setInterval(Delegate.create(this, func), 2000);

 Cheers,
 Sönke

  Hi Coders,
 
In following code, I am creating a new dynamic movie clip (in
  function N1 of script object) and associating the handler for unload
  event. Next I am deleting the same movie clip in function N3 of script
  object. But if we are calling the function N3 through setInterval
  function, movieclip unload event is not called.
 
  Now if we are calling the same function N3 directly without
  setInterval,
  unload event will be called.
 
  Someone please tell me what is happening here?
 
 
 
  script = new Object();
 
  Delay = new Object();
 
 
 
  // Delay Object
 
  Delay.delay = function(obj, func)
 
  {
 
this.mObj = obj;
 
this.mFunc = func;
 
// Calling function after an interval of 2 seconds.
 
setInterval(this.func, 2000, this);
 
  }
 
 
 
  Delay.func = function(obj)
 
  {
 
var temp = obj;
 
// Calling function N3 of class script.
 
temp.mObj[temp.mFunc]();
 
  }
 
 
 
  // Script Object
 
  script.N1 = function()
 
  {
 
// Creating a new movie clip.
 
_root.createEmptyMovieClip(Dhiraj, 1);
 
 
 
  // Associating unload event with it.
 
_root.Dhiraj.onUnload = function()
 
{
 
  trace(Dhiraj Unload);
 
}
 
 
 
// Storing the movie clip instance in member variable.
 
this.mMC = _root.Dhiraj;
 
 
 
// Calling next function of script.
 
this.N2();
 
  }
 
 
 
  script.N2 = function()
 
  {
 
  // Calling N3 after some delay.
 
Delay.delay(this, N3);
 
  }
 
 
 
  script.N3 = function()
 
  {
 
this.mMC.removeMovieClip();
 
  }
 
 
 
  script.N1();  // Calling first function of script.
 
 
 
  Regards:
 
  Dhiraj
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] SetInterval Magic

2006-01-11 Thread Dhiraj Girdhar
Hi Guys,

I am using second option of setInterval, but I am not able to 
understand the scope issue here.
Is there any solution other than Delegates? As, I am working for Flash 6 also.

'D'

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alias
Sent: Wednesday, January 11, 2006 6:09 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] SetInterval Magic

Hi guys,

It's important to realise that setInterval has two different ways to call it.

The first, and most commonly used, is this:

setInterval(functionReference:Function, interval:Number,
[param1:Object, param2, ..., paramN]) : Number

The second, which is less well known, but substantially more reliable, is this:

setInterval(objectReference:Object, methodName:String,
interval:Number, [param1:Object, param2, ..., paramN]) : Number



Although the first example will work, the function will execute in the
wrong scope.
The second, however, because it allows you to specify the scope in
which it executes, is far more reliable.

For example, if I'm inside a class, and want to call a public method
of that same class every 1000 ms, I would use:

setInterval(this,myFunction,1000);

What's important to understand here is the difference between passing
the name of the function, and *the function itself* - which is what's
happening in the first example. There has been a lot of confusion
about this over the past few years, mostly due to ambiguous
documentation. Have a look here for a well written piece of
documentation on the subject:

http://livedocs.macromedia.com/flash/8/main/1766.html

Hope this helps,
Alias


On 1/11/06, Sönke Rohde [EMAIL PROTECTED] wrote:
 Hi,
 This is a scope-issue. Try

 import mx.utils.Delegate
 ...
 setInterval(Delegate.create(this, func), 2000);

 Cheers,
 Sönke

  Hi Coders,
 
In following code, I am creating a new dynamic movie clip (in
  function N1 of script object) and associating the handler for unload
  event. Next I am deleting the same movie clip in function N3 of script
  object. But if we are calling the function N3 through setInterval
  function, movieclip unload event is not called.
 
  Now if we are calling the same function N3 directly without
  setInterval,
  unload event will be called.
 
  Someone please tell me what is happening here?
 
 
 
  script = new Object();
 
  Delay = new Object();
 
 
 
  // Delay Object
 
  Delay.delay = function(obj, func)
 
  {
 
this.mObj = obj;
 
this.mFunc = func;
 
// Calling function after an interval of 2 seconds.
 
setInterval(this.func, 2000, this);
 
  }
 
 
 
  Delay.func = function(obj)
 
  {
 
var temp = obj;
 
// Calling function N3 of class script.
 
temp.mObj[temp.mFunc]();
 
  }
 
 
 
  // Script Object
 
  script.N1 = function()
 
  {
 
// Creating a new movie clip.
 
_root.createEmptyMovieClip(Dhiraj, 1);
 
 
 
  // Associating unload event with it.
 
_root.Dhiraj.onUnload = function()
 
{
 
  trace(Dhiraj Unload);
 
}
 
 
 
// Storing the movie clip instance in member variable.
 
this.mMC = _root.Dhiraj;
 
 
 
// Calling next function of script.
 
this.N2();
 
  }
 
 
 
  script.N2 = function()
 
  {
 
  // Calling N3 after some delay.
 
Delay.delay(this, N3);
 
  }
 
 
 
  script.N3 = function()
 
  {
 
this.mMC.removeMovieClip();
 
  }
 
 
 
  script.N1();  // Calling first function of script.
 
 
 
  Regards:
 
  Dhiraj
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] setInterval() and the trouble

2005-10-30 Thread Kent Humphrey

Eric E. Dolecki wrote:

use setTimeout now and you dont need to worry about interval ids.

e.dolecki




Have you found any documentation about setTimeout - because I haven't :
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] setInterval() and the trouble

2005-10-30 Thread eric dolecki
Its undocumented, but it works in a fire once kind of situation  like
javascript:

foo = setTimeout( func, ms)
clearTimeout(foo)

but only if you need to stop the interval. Otherwise, just fire it and
forget it.

e.d.

On 10/30/05, Kent Humphrey [EMAIL PROTECTED] wrote:
 Eric E. Dolecki wrote:
  use setTimeout now and you dont need to worry about interval ids.
 
  e.dolecki
 
 

 Have you found any documentation about setTimeout - because I haven't :
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] setInterval() and the trouble

2005-10-30 Thread Tim Beynart
Why is something so useful undocumented? I have to bend over backwards
to create single-fire timers.
Thanks for the post. 


-Original Message-
Its undocumented, but it works in a fire once kind of situation  like
javascript:

foo = setTimeout( func, ms)
clearTimeout(foo)

but only if you need to stop the interval. Otherwise, just fire it and
forget it.

e.d.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] setInterval() and the trouble

2005-10-30 Thread Steve Rankin
Not sure, but it's in the new ActionScript 2.0 Language Reference for Flash
Player 8.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tim Beynart
Sent: Sunday, October 30, 2005 2:59 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] setInterval() and the trouble

Why is something so useful undocumented? I have to bend over backwards
to create single-fire timers.
Thanks for the post. 


-Original Message-
Its undocumented, but it works in a fire once kind of situation  like
javascript:

foo = setTimeout( func, ms)
clearTimeout(foo)

but only if you need to stop the interval. Otherwise, just fire it and
forget it.

e.d.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] setInterval() and the trouble

2005-10-30 Thread Peter O'Brien

perhaps it's liable to change

On 30 Oct 2005, at 21:50, Derek Vadneau wrote:

Actually, it's not documented.  I remember reading about it at some  
point,
but the local docs and livedocs do not have setTimeout, and it does  
not

light-up for syntax highlighting.

It works, but why this would not be documented is beyond me.


Derek Vadneau


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve
Rankin
Sent: Sunday, October 30, 2005 4:37 PM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] setInterval() and the trouble


Not sure, but it's in the new ActionScript 2.0 Language Reference for
Flash
Player 8.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] setInterval() and the trouble

2005-10-30 Thread Weyert de Boer

I got some stuff working now ;-=)
Looks like I had some infinite loop indeed. Pff.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] setInterval() and the trouble

2005-10-29 Thread Liam Morley
I imagine you're calling clearInterval with the appropriate interval ID upon
each quiz question submittal, and then afterwards recalling setInterval for
the new question? How does it fail the second time? Does it just never call
it again, or does it call the function at a different interval?

Liam


On 10/29/05, Weyert de Boer [EMAIL PROTECTED] wrote:

 Hmm, I am currently working on the good version of the quiz only I
 have a question how I should implementate some part. The quiz should ask
 yes/no questions and the user should only have three to six seconds to
 answer the question. If the user fails to answer the question within
 this time, the answer should be fault. Currently I used a setInterval()
 with 3000ms only I never get stuff with intervals right. Always it goes
 all fine the first question, but the second it fals. Does anyone know a
 good way to implementate this? Maybe through event delegation instead of
 a interval callback method?

 Yours,

 Weyert de Boer
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] setInterval() and the trouble

2005-10-29 Thread JOR

At first glance it looks like you have a potential continuous loop issue?

stopwatchComplete()  questionComplete()  stopwatchComplete()  and 
so on if (id = questions.length)


Second is I don't see where id is defined in questionComplete() did 
you mean to type this instead:


   if ( questionId = questions.length )



JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net






Weyert de Boer wrote:

Hi Liam,

First of all I always have had trouble with those methods, never got it 
right. Always failed, I don't they dont like!


I imagine you're calling clearInterval with the appropriate interval 
ID upon
each quiz question submittal, and then afterwards recalling 
setInterval for
the new question? How does it fail the second time? Does it just never 
call

it again, or does it call the function at a different interval?

Well, I happen to have a resource xml file which get loaded prioer of 
each group of questions, once this group is readed a
method in the root timeline gets triggered which will determine what to 
do. This method will also trigger the method buildQuestion() when
required, this method will create a new instance of 
question-movieclip. After this part is done the function doStopwatch() 
is called:


function doStopwatch() {
  // 1second = 1000ms
   _root.stopwatchIntervalId = setInterval( _root.stopwatchComplete, 
3000 );

}

function stopwatchComplete() {
   clearInterval( _root.stopwatchIntervalId );
 // trigger the question completed method
   _root.questionComplete( _root.question.id, _root.question.type );
}

function questionComplete( questionId, questionType ) {
   if ( id = questions.length ) {
// out of questions
_root.stopwatchComplete();
   } else {
 // next quesiton
 buildQuestion( questionId + 1 );
   }
}

IF you have a better solution please let me know! I feel so stupid that 
I don't get thing timer stuff working.


Yours,
Weyert de Boer


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] setInterval() and the trouble

2005-10-29 Thread Eric E. Dolecki

use setTimeout now and you dont need to worry about interval ids.

e.dolecki


On Oct 29, 2005, at 11:21 AM, Weyert de Boer wrote:


JOR wrote:


At first glance it looks like you have a potential continuous loop  
issue?


stopwatchComplete()  questionComplete()  stopwatchComplete()  
 and so on if (id = questions.length)


Second is I don't see where id is defined in questionComplete()  
did you mean to type this instead:




The id should ofcourse matched the correct name of the parameter.  
If you know a better way please let me know!





   if ( questionId = questions.length )



Aha, good one I will try ;-)

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders