# After 20 seconds gotoAndPlay()?

**URL:** https://forum.kirupa.com/t/after-20-seconds-gotoandplay/21851
**Category:** Uncategorized
**Created:** [May 27, 2003, 10:23am UTC](https://forum.kirupa.com/t/after-20-seconds-gotoandplay/21851 "2003-05-27T10:23:07Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![grooove](https://avatars.discourse-cdn.com/v4/letter/g/7feea3/32.png) [@grooove](https://forum.kirupa.com/u/grooove)
#### Post date: [May 27, 2003, 10:23am UTC](https://forum.kirupa.com/t/after-20-seconds-gotoandplay/21851/1 "2003-05-27T10:23:07Z")

</div>

hi…

how can i made something happen after 20 seconds?

something like:

after 20 seconds, gotoAndPlay()

is this possible?

thanx  
gr000ve

---

<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: [May 27, 2003, 10:33am UTC](https://forum.kirupa.com/t/after-20-seconds-gotoandplay/21851/2 "2003-05-27T10:33:47Z")

</div>

try…  
[AS]  
stime=getTimer()/1000;  
nsec=20;  
this.onEnterFrame=function(){  
if((getTimer()-stime)\>nsec){  
gotoAndPlay(x);  
}  
}[/AS]

i havent test that but i think it should work.

---

<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: [May 27, 2003, 10:47am UTC](https://forum.kirupa.com/t/after-20-seconds-gotoandplay/21851/3 "2003-05-27T10:47:28Z")

</div>

doesn´t work :sigh:

can you give one more try? 🙂

---

<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: [May 27, 2003, 10:50am UTC](https://forum.kirupa.com/t/after-20-seconds-gotoandplay/21851/4 "2003-05-27T10:50:16Z")

</div>

```auto
myGotoAndPlay = function (frame) {
	gotoAndPlay(frame);
	clearInterval(myInterval);
};
var myInterval = setInterval(myGotoAndPlay, 20000, 20);

```

---

<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: [May 27, 2003, 11:12am UTC](https://forum.kirupa.com/t/after-20-seconds-gotoandplay/21851/5 "2003-05-27T11:12:06Z")

</div>

ok

thanx to both!!

i solved it like this

myInterval = setInterval (slideShow, 20000);

function slideShow () {  
gotoAndPlay (2);  
}

and then i killed the funtion with this:

clearInterval(myInterval);

---

<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: [May 27, 2003, 11:43am UTC](https://forum.kirupa.com/t/after-20-seconds-gotoandplay/21851/6 "2003-05-27T11:43:19Z")

</div>

😉

---

<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: [May 27, 2003, 11:55am UTC](https://forum.kirupa.com/t/after-20-seconds-gotoandplay/21851/7 "2003-05-27T11:55:07Z")

</div>

sorry bout that…

[AS]  
stime=getTimer();  
nsec=2;  
\_root.onEnterFrame=function(){  
if((getTimer()-stime)\>nsec\*1000){  
gotoAndPlay(x);  
}  
}  
[/AS]
