# setInterval help

**URL:** <https://forum.kirupa.com/t/setinterval-help/177963>\
**Category:** Uncategorized\
**Created:** [February 6, 2006, 7:44pm UTC](https://forum.kirupa.com/t/setinterval-help/177963 "2006-02-06T19:44:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul\_ferrie](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@paul\_ferrie](https://forum.kirupa.com/u/paul_ferrie)\
**Post date:** [February 6, 2006, 7:44pm UTC](https://forum.kirupa.com/t/setinterval-help/177963/1 "2006-02-06T19:44:35Z")

</div>

Hi guys.  
i am tinkering about with an idea of setting auto slide show for a gallery that i am working on.  
Reading over some post’s regarding the topic i went with using setInterval.

ActionScript Code:  
[FONT=Courier New][LEFT]\</p\>  
\<p\>function slideShow COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]\</p\>  
\<p\> [COLOR=#000000] **var** [/COLOR] intervalId:[COLOR=#0000ff]Number[/COLOR];\</p\>  
\<p\> [COLOR=#000000] **var** [/COLOR] count:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]1[/COLOR];\</p\>  
\<p\> [COLOR=#000000] **var** [/COLOR] maxCount:[COLOR=#0000ff]Number[/COLOR] = totalPages.[COLOR=#0000ff]text[/COLOR];\</p\>  
\<p\> [COLOR=#000000] **var** [/COLOR] [COLOR=#0000ff]duration[/COLOR]:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]5000[/COLOR];\</p\>  
\<p\> [COLOR=#000000] **function** [/COLOR] executeCallback COLOR=#000000[/COLOR]:[COLOR=#0000ff]Void[/COLOR] [COLOR=#000000]{[/COLOR]\</p\>  
\<p\> [COLOR=#0000ff]trace[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#ff0000]"executeCallback intervalId: “[/COLOR] + intervalId + [COLOR=#ff0000]” count: "[/COLOR] + count[COLOR=#000000])[/COLOR];\</p\>  
\<p\> [COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR]count \>= maxCount[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]\</p\>  
\<p\> [COLOR=#0000ff]clearInterval[/COLOR] COLOR=#000000[/COLOR];\</p\>  
\<p\> [COLOR=#000000]}[/COLOR]\</p\>  
\<p\> count++;\</p\>  
\<p\> [COLOR=#000000]}[/COLOR]\</p\>  
\<p\> intervalId = [COLOR=#0000ff]setInterval[/COLOR] [COLOR=#000000]([/COLOR]executeCallback, [COLOR=#ff0000]“executeCallback”[/COLOR], [COLOR=#0000ff]duration[/COLOR][COLOR=#000000])[/COLOR];\</p\>  
\<p\>[COLOR=#000000]}[/COLOR]\</p\>  
\<p\>  
[/LEFT]  
[/FONT]

The code does work but the duration does not.  
Function should be called every 5 seconds but instead is called every second. I know it probs my coding. Can someone see where i am going wrong.  
Thanks  
Paul
