# Hittest timeline

**URL:** <https://forum.kirupa.com/t/hittest-timeline/236927>\
**Category:** flash\
**Created:** [August 25, 2007, 12:56am UTC](https://forum.kirupa.com/t/hittest-timeline/236927 "2007-08-25T00:56:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chase\_Watkins](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@Chase\_Watkins](https://forum.kirupa.com/u/Chase_Watkins)\
**Post date:** [August 25, 2007, 12:56am UTC](https://forum.kirupa.com/t/hittest-timeline/236927/1 "2007-08-25T00:56:23Z")

</div>

Hello everybody, I’m new to the forum!

I’ve got a problem with a game I am creating, I want a movie clip to play once when my character hits it, it has a stop function at the end of the movie clip, but as long as the character is on top of it, it continues to loop, how do I get it to stop at the last frame?  
Here is the script applied to the movie clip:

onClipEvent (enterFrame) {  
if (this.hitTest(\_root.bubMC)) {  
play();  
}  
}

All I’ve been able to do was make the last frame extremely long and load an alternate movieclip without the hittest function applied that runs the animation.

Essentially, I am asking, “How do I make a piece of actionscript run only once”, like:

onClipEvent (enterFrame) {  
if (this.hitTest(\_root.bubMC)) {  
play(ONLY ONCE BUT AFTER THAT DON’T DO IT AGAIN);  
}  
}

: ]
