# Help with setInterval(); or similar?

**URL:** <https://forum.kirupa.com/t/help-with-setinterval-or-similar/186224>\
**Category:** flash\
**Created:** [April 19, 2006, 9:20pm UTC](https://forum.kirupa.com/t/help-with-setinterval-or-similar/186224 "2006-04-19T21:20:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maccapug](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@maccapug](https://forum.kirupa.com/u/maccapug)\
**Post date:** [April 19, 2006, 9:20pm UTC](https://forum.kirupa.com/t/help-with-setinterval-or-similar/186224/1 "2006-04-19T21:20:22Z")

</div>

Hello,

I have used the moveTo & lineTo commands to create a simple line effect that appears during MovieClip.onRollOver. Can someone show me how to use setInterval() to allow this simple effect to first appear and then be cleared after 1 or 2 seconds (while in the onRollOver state)? Here is what I have so far:

myclip.onRollOver = overclip;

function overclip() {

\_root.createEmptyMovieClip(“theline\_mc”,1);  
theline\_mc.lineStyle(6,0xFFCCCC,85);  
theline\_mc.moveTo(52,-139);  
theline\_mc.lineTo(106,-195);  
}

how do you set up the setInterval() timer for this?

Oh, and I am using Flash 8 to create this… Thanks!

---

<div class="post-metadata">

**Author:** ![Joppe](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@Joppe](https://forum.kirupa.com/u/Joppe)\
**Post date:** [April 19, 2006, 9:45pm UTC](https://forum.kirupa.com/t/help-with-setinterval-or-similar/186224/2 "2006-04-19T21:45:47Z")

</div>

well looks like you already got the rollover code so

```auto

function overclip() {

_root.createEmptyMovieClip("theline_mc",1);
theline_mc.lineStyle(6,0xFFCCCC,85);
theline_mc.moveTo(52,-139);
theline_mc.lineTo(106,-195);
if(!sett){
g = setInterval(remov,2000);
sett = true;
}
}
sett = false;
remov = function(){
sett = false;
clearInterval(g);
};

```

try something like that  
(not tested)

---

<div class="post-metadata">

**Author:** ![maccapug](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@maccapug](https://forum.kirupa.com/u/maccapug)\
**Post date:** [April 20, 2006, 1:07am UTC](https://forum.kirupa.com/t/help-with-setinterval-or-similar/186224/3 "2006-04-20T01:07:39Z")

</div>

Hi Joppe,

Your solution doesn’t seem to work. Any other suggestions?

Thanks

---

<div class="post-metadata">

**Author:** ![cobrasniper555](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@cobrasniper555](https://forum.kirupa.com/u/cobrasniper555)\
**Post date:** [April 20, 2006, 1:49am UTC](https://forum.kirupa.com/t/help-with-setinterval-or-similar/186224/4 "2006-04-20T01:49:55Z")

</div>

```auto
setInterval(the function you want to perform, for how many milliseconds)

```

If you want me to write you the code for you, then I’ll do it, but not now. But, after you have your loaded data set up, put the setInterval() function in.

---

<div class="post-metadata">

**Author:** ![maccapug](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@maccapug](https://forum.kirupa.com/u/maccapug)\
**Post date:** [April 21, 2006, 11:24pm UTC](https://forum.kirupa.com/t/help-with-setinterval-or-similar/186224/5 "2006-04-21T23:24:00Z")

</div>

> [@cobrasniper555](#):
>
> ```auto
> setInterval(the function you want to perform, for how many milliseconds)
> 
> ```
> 
> If you want me to write you the code for you, then I’ll do it, but not now. But, after you have your loaded data set up, put the setInterval() function in.

Thanks for your help. I figured this one out
