# Need help with on/off buttons

**URL:** https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043
**Category:** flash
**Created:** [August 21, 2003, 2:35pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043 "2003-08-21T14:35:15Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Sauce2k](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@Sauce2k](https://forum.kirupa.com/u/Sauce2k)
#### Post date: [August 21, 2003, 2:35pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/1 "2003-08-21T14:35:15Z")

</div>

I want to make a set of buttons, on and off, which will cause the animation shown [here](http://www.kirupa.com/developer/mx/vibrate.htm) to be stoped and resumed. Can anyone provide the proper actionscript for each of the buttons?

---

<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 21, 2003, 2:50pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/2 "2003-08-21T14:50:46Z")

</div>

like:

```auto

on (release){
movieClip.stop();
//replace movieClip with your mc name.
}

```

and

```auto

on (release){
movieClip.play();
}

```

try something like that.

---

<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 21, 2003, 2:55pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/3 "2003-08-21T14:55:18Z")

</div>

it doesn’t work, i even tried \_root.circle.play(); &  
\_root.circle.stop(); and it still doesn’t work, any other ideas?

---

<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 21, 2003, 3:18pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/4 "2003-08-21T15:18:47Z")

</div>

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=31875](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=31875)

---

<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 22, 2003, 5:51pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/5 "2003-08-22T17:51:55Z")

</div>

Hi,  
Did you solve your problem from the thread that Voetsjoeba posted for you ?

If not, tell me, do you want each button to be on **&** off or do you want an **ON** and **OFF** button for each ani ?

Cheers

SteveD

---

<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 22, 2003, 5:55pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/6 "2003-08-22T17:55:18Z")

</div>

> Hi,  
> Did you solve your problem from the thread that Voetsjoeba posted for you ?

If not, tell me, do you want each button to be on & off or do you want an ON and OFF button for each ani ?

Cheers

SteveD

No unfortunatly the problem still continues. If you can help, i want 2 seperate buttons, one to stop the animation (off) and one to start the animation (on) The animation is set by default to start automatically when you enter a specific frame.

Thx 😛

---

<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 22, 2003, 6:10pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/7 "2003-08-22T18:10:18Z")

</div>

Maybe this helps

---

<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 22, 2003, 6:33pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/8 "2003-08-22T18:33:14Z")

</div>

Hi,  
Nice one Claudio, my version does the same, tho’ I have stuck to basic button actions, therefore more lines of code.

between the 2 files Sauce2k you should solve your prob. Any Q’s post again

SteveD

---

<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 22, 2003, 7:52pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/9 "2003-08-22T19:52:11Z")

</div>

> Hi,  
> Nice one Claudio, my version does the same, tho’ I have stuck to basic button actions, therefore more lines of code.

between the 2 files Sauce2k you should solve your prob. Any Q’s post again

SteveD

Your fla’s, although nicely scripted, only work for tweened animations, not action scripted like the vibration effect. The stop(); command doesn’t do anything because inside the movieclip circle, there is no animation. Instead actionscript animates it, so therefore, I need and on and off button, which sets a certain x and y position of the circle to keep it from moving. If you can help me in doing this, that would be great 😏

---

<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 23, 2003, 2:47am UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/10 "2003-08-23T02:47:55Z")

</div>

hmm well what effect are you trying to do? if you want it to stop scripted animations try a boolean…

in the first frame declare var play = true;

put your whole actionscrip thing in an if statement saying

if(\_root.play)  
{  
a/s…  
}

then in your buttons change play to true for on and to false for off…

since you declared it in the frame use \_root.play = true; or \_root.play = false;

in your if statement use if(\_root.play) for the same reason

should work

---

<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 23, 2003, 2:51am UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/11 "2003-08-23T02:51:43Z")

</div>

> hmm well what effect are you trying to do?

As i said in my first post, i am using the vibration effect :esmirk:

Could you make an fla with the vibration effect and the buttons by any chance?

---

<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 23, 2003, 4:07am UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/12 "2003-08-23T04:07:47Z")

</div>

here ya go

---

<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 23, 2003, 2:16pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/13 "2003-08-23T14:16:20Z")

</div>

thx dude :beam:

---

<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 23, 2003, 3:17pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/14 "2003-08-23T15:17:25Z")

</div>

Well, why can’t you just make the buttons inside the movieClip? This way when the stop button is pressed, its stops the movie, and when the play button is pressed it plays. Or you could make 2 keyframes, 1 with the thingies there and one without. [Play] gotoandStops at 1. [Stop] gotoandStops at 2. 😏

---

<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 23, 2003, 4:36pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/15 "2003-08-23T16:36:21Z")

</div>

[swf=http://www.geocities.com/claudiodj/vibrate.swf][/swf]

---

<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 23, 2003, 5:27pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/16 "2003-08-23T17:27:16Z")

</div>

And this would be the fla 😉

---

<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 23, 2003, 5:36pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/17 "2003-08-23T17:36:29Z")

</div>

lol i forgot to attach the fla :trout:  
though voetsjoeba already posted, ill place my fla in case any1 wants to check

---

<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 23, 2003, 8:58pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/18 "2003-08-23T20:58:22Z")

</div>

lol i thought my way had solved the problem 😉

---

<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 23, 2003, 10:34pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/19 "2003-08-23T22:34:10Z")

</div>

nice claudio, scootman, thx for the fla, it solved the problem :thumb:

---

<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 23, 2003, 11:12pm UTC](https://forum.kirupa.com/t/need-help-with-on-off-buttons/29043/20 "2003-08-23T23:12:28Z")

</div>

Welcome 🙂
