# setInterval problem

**URL:** <https://forum.kirupa.com/t/setinterval-problem/127894>\
**Category:** Uncategorized\
**Created:** [November 7, 2004, 7:45pm UTC](https://forum.kirupa.com/t/setinterval-problem/127894 "2004-11-07T19:45:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![veronex](https://avatars.discourse-cdn.com/v4/letter/v/41988e/32.png) [@veronex](https://forum.kirupa.com/u/veronex)\
**Post date:** [November 7, 2004, 7:45pm UTC](https://forum.kirupa.com/t/setinterval-problem/127894/1 "2004-11-07T19:45:05Z")

</div>

Hello, I’m kinda new to actionscript and I wonder if someone can help me with the code listed here. My goal is to change the time for setInterval each time the function is called. Planning to replace myInterval = 5000; with a randomized number. My problem is getting setInterval to recognize the myInterval variable from the function. Any thoughts on this?

var myInterval = 1000;  
callback = function() {  
\_root.myMovie.gotoAndPlay(1);  
myInterval = 5000;  
}

setInterval(callback, myInterval);
