# Set Interval / Clear Interval question

**URL:** https://forum.kirupa.com/t/set-interval-clear-interval-question/94570
**Category:** Uncategorized
**Created:** [November 14, 2003, 4:08am UTC](https://forum.kirupa.com/t/set-interval-clear-interval-question/94570 "2003-11-14T04:08:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![cowboy71](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@cowboy71](https://forum.kirupa.com/u/cowboy71)
#### Post date: [November 14, 2003, 4:08am UTC](https://forum.kirupa.com/t/set-interval-clear-interval-question/94570/1 "2003-11-14T04:08:54Z")

</div>

Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I’m sure will help a lot of people out  
[http://www.umbc.edu/interactive/flash/tutorials/showpage.php?p=setInterval](http://www.umbc.edu/interactive/flash/tutorials/showpage.php?p=setInterval)

but I just didn’t understand how I could use that with what I’m trying to accomplish. Here is the start of my code.

onClipEvent (load) {  
myX = 650;  
myY= 480;  
div = 6;  
}  
onClipEvent (enterFrame) {  
\_x += (myX-\_x)/div;  
\_y += (myY-\_y)/div;  
}  
onClipEvent (enterFrame) {  
if (this.\_alpha \<100) {  
this.\_alpha += 5;  
}  
}

I also have the text fade in.  
I’m just not sure how to put a delay on this AS before it runs to the end.  
Just plain confused.  
Any help would be great.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 14, 2003, 6:47am UTC](https://forum.kirupa.com/t/set-interval-clear-interval-question/94570/2 "2003-11-14T06:47:07Z")

</div>

```auto

onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}

function doneDelay(){
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
if (this._alpha <100) {
this._alpha += 5;

}
}
        clearInterval(delay);

}
delay = setInterval(doneDelay, 600); //milliseconds

```

that should work
