# Linking Animation to a button

**URL:** https://forum.kirupa.com/t/linking-animation-to-a-button/65416
**Category:** flash
**Created:** [September 26, 2004, 4:43am UTC](https://forum.kirupa.com/t/linking-animation-to-a-button/65416 "2004-09-26T04:43:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![slobo747](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@slobo747](https://forum.kirupa.com/u/slobo747)
#### Post date: [September 26, 2004, 4:43am UTC](https://forum.kirupa.com/t/linking-animation-to-a-button/65416/1 "2004-09-26T04:43:46Z")

</div>

How do i link an animation to a button. What i want is: when someone presses this button the animation starts, then at the end to the animation someone presses another button to make the animation go in reverse. Thank you in advance.

---

<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: [September 26, 2004, 6:21am UTC](https://forum.kirupa.com/t/linking-animation-to-a-button/65416/2 "2004-09-26T06:21:05Z")

</div>

Select your button and open the actions panel (F9), insert this:[AS]on (release) {  
gotoAndPlay(frameNumber);  
}[/AS]Now just change “frameNumber” to wherever the animation starts. As far as making it play backwards… I don’t know if that’s possible, or maybe it is? :h:

---

<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: [September 26, 2004, 7:02am UTC](https://forum.kirupa.com/t/linking-animation-to-a-button/65416/3 "2004-09-26T07:02:18Z")

</div>

> [@wizard](#):
>
> Select your button and open the actions panel (F9), insert this:[AS]on (release) {  
> gotoAndPlay(frameNumber);  
> }[/AS]Now just change “frameNumber” to wherever the animation starts. As far as making it play backwards… I don’t know if that’s possible, or maybe it is? :h:

Well what i was thinking is that my movies start with stop action so they are there but just aren’t playing. Is there a command that makes it go. Sorry if i am a little on clear. I try not to have more than one main frame. Thank you for your reply

---

<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: [September 26, 2004, 6:18pm UTC](https://forum.kirupa.com/t/linking-animation-to-a-button/65416/4 "2004-09-26T18:18:34Z")

</div>

The gotoAndPlay will make it play regardless of the stop action in that same frame.
