# Problem with setInterval in a button

**URL:** <https://forum.kirupa.com/t/problem-with-setinterval-in-a-button/172838>\
**Category:** flash\
**Created:** [December 18, 2005, 6:46pm UTC](https://forum.kirupa.com/t/problem-with-setinterval-in-a-button/172838 "2005-12-18T18:46:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lavascoop](https://avatars.discourse-cdn.com/v4/letter/l/a698b9/32.png) [@lavascoop](https://forum.kirupa.com/u/lavascoop)\
**Post date:** [December 18, 2005, 6:46pm UTC](https://forum.kirupa.com/t/problem-with-setinterval-in-a-button/172838/1 "2005-12-18T18:46:44Z")

</div>

Hi I am having a huge problem trying to get a menu to “open” and then “close” after 3 secs, it should be simple enough…except i am no good at AS and the forums all present a different case to the problem i am having.

Here is my AS below for your reference, basically i would like to have the action sit within a menu button…mouse over, it plays up, 3 secs later, it plays down sequence.

I KNOW i made a mistake, but i cant figure out where.

on (rollOver) {tellTarget ("\_parent.\_parent.submenu\_contain") {  
trace (“open”);  
gotoAndPlay(“ae\_up”);  
var myTiming;  
myTiming = setInterval(myAction, 3000);  
function myAction(){  
tellTarget ("\_parent.\_parent.submenu\_contain") {  
gotoAndPlay(“ae\_down”);  
trace (“close”);  
clearInterval(myTiming);  
};  
};  
};  
}
