# Play once

**URL:** <https://forum.kirupa.com/t/play-once/29566>\
**Category:** Uncategorized\
**Created:** [August 28, 2003, 7:06am UTC](https://forum.kirupa.com/t/play-once/29566 "2003-08-28T07:06:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fried](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@fried](https://forum.kirupa.com/u/fried)\
**Post date:** [August 28, 2003, 7:06am UTC](https://forum.kirupa.com/t/play-once/29566/1 "2003-08-28T07:06:00Z")

</div>

I have a button. This button uses tellTarget to make a movie clip play. I only want this to happen once. The button stays on the stage while the clip plays. If the user clicks the button again the movie clip will start again. I don’t want this to happen. So user clicks, movie clip plays, user clicks again, nothing must happen.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 7:16am UTC](https://forum.kirupa.com/t/play-once/29566/2 "2003-08-28T07:16:21Z")

</div>

At a frame before the frame your button is at, place this:  
[AS]  
\_root.pressed = false;  
[/AS]

And on your button, place this:  
[AS]  
on(release){  
if(!\_root.pressed){  
\_root.movieclip.gotoAndPlay(5)  
\_root.pressed = true;  
}  
}[/AS]

Of course, \_root.movieclip.gotoAndPlay(5) is just an example of a play action. Replace it with your play action. And, you can of course also change on (release) to on(press) or anything else.
