# setInterval() question

**URL:** <https://forum.kirupa.com/t/setinterval-question/199711>\
**Category:** Uncategorized\
**Created:** [September 5, 2006, 1:02pm UTC](https://forum.kirupa.com/t/setinterval-question/199711 "2006-09-05T13:02:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![plug](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@plug](https://forum.kirupa.com/u/plug)\
**Post date:** [September 5, 2006, 1:02pm UTC](https://forum.kirupa.com/t/setinterval-question/199711/1 "2006-09-05T13:02:21Z")

</div>

hi there folks.

this is the actionscript in the main timeline of my movie:

```auto
dropMenuOpen = false; // define initial status of dropdown

menuButton_mc.onRelease = function() {
	
	trace("clicked");
	
	if (dropMenuOpen == false) {
		function myInterval() {
			trace("interval executed");
		}
		setInterval(myInterval, 1000);

		dropMenuOpen = true;
		trace("drop menu opened");
	
	} else {
		
		dropMenuOpen = false;
		trace("drop menu closed");
	
	}
	
}

```

really basic. there’s a button on the main timeline (menuButton\_mc) and when it’s clicked it uses an else/if to check if the (currently nonexistent) dropdown is open or closed. there are no problems here…

the problem is that if the condition is false, I want to execute some commands inside a setInterval(). this will not work for some reason! it seems to be an issue with the placement; if I place the setInterval() command outside the else/if, it executes fine. am I missing out on something fundamental here? helppp!

oh yeah, I’m using flash 8. 😉
