# Button rollovers

**URL:** <https://forum.kirupa.com/t/button-rollovers/20877>\
**Category:** Uncategorized\
**Created:** [May 14, 2003, 11:25am UTC](https://forum.kirupa.com/t/button-rollovers/20877 "2003-05-14T11:25:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![pez](https://avatars.discourse-cdn.com/v4/letter/p/5e9695/32.png) [@pez](https://forum.kirupa.com/u/pez)\
**Post date:** [May 14, 2003, 11:25am UTC](https://forum.kirupa.com/t/button-rollovers/20877/1 "2003-05-14T11:25:55Z")

</div>

what code do i put if i want my layers frames to run through while the mouse is rolled over top of a button, but stop when the mouse is taken off 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:** [May 14, 2003, 11:38am UTC](https://forum.kirupa.com/t/button-rollovers/20877/2 "2003-05-14T11:38:44Z")

</div>

ok i figured that one out, but how do i make the button make the layers frames run backwards instead of forwards? saying play makes it run thru the movie normally but i want it to run backwards!

---

<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:** [May 14, 2003, 11:44am UTC](https://forum.kirupa.com/t/button-rollovers/20877/3 "2003-05-14T11:44:41Z")

</div>

I think (but don’t quote me on this) that you actually have to script it to play the frames in reverse. So you’ll tell it to go to frame 10, that frame will have a prevFrame() or something in it, then go back that way…

---

<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:** [May 14, 2003, 11:52am UTC](https://forum.kirupa.com/t/button-rollovers/20877/4 "2003-05-14T11:52:24Z")

</div>

but if i say go to previous frame, it only goes to the immediate previous frame, and doesn’t run thru all the frames backwards until the mouse is taken off. so when this happens you have to keep wiggling your mouse over and off the button to make it to move to each previous frame individually. how can i make it run backwards continously while the mouse is 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:** [May 14, 2003, 11:53am UTC](https://forum.kirupa.com/t/button-rollovers/20877/5 "2003-05-14T11:53:32Z")

</div>

so at the moment my code for the button is

on (rollOver) {  
play();  
prevFrame();  
}  
on (rollOut) {  
stop();  
}

but it only does what i said it does above

---

<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:** [May 14, 2003, 11:55am UTC](https://forum.kirupa.com/t/button-rollovers/20877/6 "2003-05-14T11:55:38Z")

</div>

Try using this:[AS]gotoAndStop(\_currentframe-1);[/AS]  
hope it 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:** [May 14, 2003, 12:17pm UTC](https://forum.kirupa.com/t/button-rollovers/20877/7 "2003-05-14T12:17:39Z")

</div>

where in my script should i put 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:** [May 15, 2003, 7:54am UTC](https://forum.kirupa.com/t/button-rollovers/20877/8 "2003-05-15T07:54:33Z")

</div>

Sorry if I haven’t replied earlier…

```auto

on(rollOver){
gotoAndStop(_currentframe-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:** [May 15, 2003, 8:35am UTC](https://forum.kirupa.com/t/button-rollovers/20877/9 "2003-05-15T08:35:53Z")

</div>

Pez, you can also use hitTest as well. I find it to be more sensitive to the mouse than using rollOver. Take a look at the example FLA I attached to this post, enjoy. =)

---

<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:** [May 15, 2003, 9:10am UTC](https://forum.kirupa.com/t/button-rollovers/20877/10 "2003-05-15T09:10:57Z")

</div>

hi

this is very simple,

I can solver your problem.

I have done one sample swf for you, please download it and gothrought it. If it is clear, please mail me to [bsprathapsimha@rediffmail.com](mailto:bsprathapsimha@rediffmail.com), I will send you the code

bye,  
Prathap
