# Repeating the mouse down in flash

**URL:** https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433
**Category:** Uncategorized
**Created:** [February 1, 2002, 1:02pm UTC](https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433 "2002-02-01T13:02:32Z")
**Posts on this page:** 8
**Page:** 1

<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: [February 1, 2002, 1:02pm UTC](https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433/1 "2002-02-01T13:02:32Z")

</div>

How can I create a button that will repeat an action for as long as the mouse button is down on 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: [February 1, 2002, 1:31pm UTC](https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433/2 "2002-02-01T13:31:58Z")

</div>

Create a movie clip inside the button. Use these commands or something similar; On mouse event/Press/Load Movie (Inside this movie create the actions you are desiring). This should solve your problem.\r\rpj

---

<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: [February 1, 2002, 2:16pm UTC](https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433/3 "2002-02-01T14:16:21Z")

</div>

I don’t know if you completly understand me…What I need is a code that will repeat an action when the button is clicked or actually rolled 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: [February 1, 2002, 3:29pm UTC](https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433/4 "2002-02-01T15:29:34Z")

</div>

if the action that you want is just an animation then it then all you have to do is nothing. The movie clip will repeat as long as the mouse is over the button. It is harder to do when you want it on a click since people usually don’t hold down their button very long.\r\rMaybe if you tell us what actions you want repeated, it will help answer your question.\r\rMatt

---

<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: [February 1, 2002, 4:19pm UTC](https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433/5 "2002-02-01T16:19:03Z")

</div>

Here is the code I am attempting to use…\r\ron (press, keyPress “\<Left\>”) {\r&nbsp &nbsp &nbsp &nbsp tellTarget (“webimaging”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (\_currentframe-1);\r&nbsp &nbsp &nbsp &nbsp }\r}

---

<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: [February 1, 2002, 4:23pm UTC](https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433/6 "2002-02-01T16:23:57Z")

</div>

I believe “press” is only accounted for once, so the action related to the event happens only once too…\rMaybe use a variable you use as a switch: on press, var=1, and while var=1, do this (whatever);\ron release, var=0, and so, the condition checked with vars value not being true anymore, the action should stop…?\rHaven’t tried…

---

<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: [February 1, 2002, 5:42pm UTC](https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433/7 "2002-02-01T17:42:10Z")

</div>

Totally agree With the Eyez. Use flags.\rpom 0]

---

<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: [February 1, 2002, 7:53pm UTC](https://forum.kirupa.com/t/repeating-the-mouse-down-in-flash/3433/8 "2002-02-01T19:53:23Z")

</div>

the “button in a movie” technique will do the trick.\r\rmake a button:

```auto
 \r\ron(press){\r\r mpress = 1;\r\r}\r\r\r\ron(release,releaseOutside){\r\r mpress=0;\r\r}

```

\r\rmake that button a movie, and in the movie:

```auto
 \r\ronClipEvent(enterFrame){\r\r if(mpress){\r\r _root.webimaging.prevFrame();\r\r }\r\r}

```

\r
