# Continusly movement on button hold

**URL:** <https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589>\
**Category:** Uncategorized\
**Created:** [August 19, 2004, 7:31pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589 "2004-08-19T19:31:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![julpa](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@julpa](https://forum.kirupa.com/u/julpa)\
**Post date:** [August 19, 2004, 7:31pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/1 "2004-08-19T19:31:52Z")

</div>

so yeah like it says i want to have a button and when you hold it a movie clip continusuly moves downward. so yeah.

basically there is no option that i can uses such as

on(hold);

cause well thats not a script. so anyways anyone know how i can do this? or how i can check to see if the mouse is pressed over the button?

---

<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 19, 2004, 10:09pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/2 "2004-08-19T22:09:46Z")

</div>

Here, I’m not boasting or anything but look at the buttons on the top of my page and tell me if this is what you are talking about? I did my buttons as movieclips with a ‘dummy\_button’ over the top of them for the actionscript (i.e. rollOver,rollOut etc). This way it gives you more options as to what you want your buttons to act like.

My site: [http://rberry883.home.comcast.net](http://rberry883.home.comcast.net)

If this is not what you are looking for then disregard the above (and stop laughing at my site! 🙂 ) and someone who knows what they are doing can help you.

---

<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 19, 2004, 10:54pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/3 "2004-08-19T22:54:55Z")

</div>

give the movieclip an instance name, my example will be imaginatively named _myMC_ :P.

on your button, have an on(press) event as follows… assuming the movieclip is on the \_root level:

```auto
on (press) {
	_root.myMC.onEnterFrame = function(){
		this._y++
	}
}
on (release) {
	delete _root.myMC.onEnterFrame
}

```

note you mite want an on(releaseOutside) identical to on(release)

Prophet.

---

<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 19, 2004, 10:59pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/4 "2004-08-19T22:59:20Z")

</div>

Prophet is right on about this… you can, however, use the same function for release and releaseOutside. the whole code would be as follows:

```auto
  
on (press) {
	   _root.myMC.onEnterFrame = function(){
			  this._y++
   }
}
on (release, releaseOutside) {
   delete _root.myMC.onEnterFrame
}
 

```

---

<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 19, 2004, 11:03pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/5 "2004-08-19T23:03:41Z")

</div>

thanks mattvenables… i didnt actually know that!! u learn sumit evryday 😉 lol

Prophet.

---

<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 19, 2004, 11:22pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/6 "2004-08-19T23:22:51Z")

</div>

```auto
on(rollOver){
	gotoAndPlay("over");
}
on(press){
	gotoAndPlay("down");
}
on(rollOut, releaseOutside){
	gotoAndPlay("goback");
}
on(release){
	with(_root){
		gotoAndPlay("Home");
}
}

```

This is the actionscript for the dummy button that acts as the hit area of my movieclip buttons. Maybe not the cleanest I like it better than trying to get button symbols to behave with something more than just up,down,over.

---

<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 19, 2004, 11:41pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/7 "2004-08-19T23:41:43Z")

</div>

mattvenables, prophet worked great. anyways i guess with it being y++ theres no way i could speed it up without increasing the fps?

also another quick question, how do i load (or “activate”) a movie clip from a button.

anyways great replies.

---

<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 20, 2004, 9:07pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/8 "2004-08-20T21:07:12Z")

</div>

:bump:

---

<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 20, 2004, 11:27pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/9 "2004-08-20T23:27:21Z")

</div>

simply change _y++_ to _y+=x_ and rather than increase by 1, it will increase y by however many x represents (eg. _y+=5_)

give your mc an instance name and use its path to activate it: easiest way, have a blank frame on first frame and have action _stop()_ on it and then on your button use sumit like _\_root.myMC.play()_ wer _myMC_ is the instance name you gave it… assuming your mc is on the main timeline 😉

Prophet.

PS glad i could help 😉

---

<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, 2004, 7:14am UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/10 "2004-08-21T07:14:33Z")

</div>

wow i guess i was thinking it would be really complicated like \_root.load.function.math.pi(54%6);;{}sd.mymc i dunno oh well worked great again.

---

<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, 2004, 12:57pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/11 "2004-08-21T12:57:46Z")

</div>

happy flashing 🙂

Prophet.

---

<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, 2004, 3:02pm UTC](https://forum.kirupa.com/t/continusly-movement-on-button-hold/61589/12 "2004-08-22T15:02:59Z")

</div>

hehe. I love to flash 😉
