# MC !hittest setinterval play

**URL:** https://forum.kirupa.com/t/mc-hittest-setinterval-play/95880
**Category:** Uncategorized
**Created:** [December 1, 2003, 11:35pm UTC](https://forum.kirupa.com/t/mc-hittest-setinterval-play/95880 "2003-12-01T23:35:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kill\_robot\_kill](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kill_robot_kill/32/359_2.png) [@kill\_robot\_kill](https://forum.kirupa.com/u/kill_robot_kill)
#### Post date: [December 1, 2003, 11:35pm UTC](https://forum.kirupa.com/t/mc-hittest-setinterval-play/95880/1 "2003-12-01T23:35:39Z")

</div>

ok, I will try and be as descriptive as possible.  
I have a button that tells a movie clip (“holder”) to gotoAndStop(2);

on frame 2. I have a box, if the mouse is off the box, I want the MC to go to play() after 5 seconds.  
But since the button and box are on other sides of the screen, the play() after 5 seconds part has to wait, until the user, touches the box, and then mouses off the box for 5 seconds.

this is the code on the holder mc:  
[AS]onClipEvent (enterFrame) {  
if (bound.mcOpen) {  
if (!this.hitTest(\_root.\_xmouse, \_root.\_ymouse, true)) {  
setInterval(function(){ play(); }, 1000);   
}

```
}

```

}  
[/AS]

right now, that is causing the movieclip to play/loop. I either need a way to break the function or the setInterval, to make sure it only plays once.

or if there is a better way to accomplish this, that would be cool.
