# Button loses it's rollover functions

**URL:** <https://forum.kirupa.com/t/button-loses-its-rollover-functions/57790>\
**Category:** Uncategorized\
**Created:** [July 16, 2004, 3:15am UTC](https://forum.kirupa.com/t/button-loses-its-rollover-functions/57790 "2004-07-16T03:15:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![orionstar](https://avatars.discourse-cdn.com/v4/letter/o/51bf81/32.png) [@orionstar](https://forum.kirupa.com/u/orionstar)\
**Post date:** [July 16, 2004, 3:15am UTC](https://forum.kirupa.com/t/button-loses-its-rollover-functions/57790/1 "2004-07-16T03:15:56Z")

</div>

I have a movieclip that has a button symbol in it.

When it is a movieclip and I put this AS on it:  
on (press,release) {  
\_root.all\_stage.gotoAndStop(23);  
\_root.all\_stage.lb2\_stage.gotoAndPlay(2);  
}

It works fine, but loses the button rollover qualities.

I tried turning the above into a button to remedy it , but then the rollover works BUT the AS doesn’t.

Please help, been pulling my hair out.

Thanks 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:** [July 16, 2004, 3:44am UTC](https://forum.kirupa.com/t/button-loses-its-rollover-functions/57790/2 "2004-07-16T03:44:09Z")

</div>

make it a movie clip and give it this AS  
onClipEvent(load) {  
this.onPress = this.onRelease = function(){  
\_root.all\_stage.gotoAndStop(23);  
\_root.all\_stage.lb2\_stage.gotoAndPlay(2);  
}  
}  
if you want the press and release events to do something different from each other do this  
onClipEvent(load) {  
this.onPress = function(){  
\_root.all\_stage.gotoAndStop(23);  
\_root.all\_stage.lb2\_stage.gotoAndPlay(2);  
}  
this.onRelease = function(){  
//do some other stuff on release  
}

}

---

<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:** [July 16, 2004, 12:37pm UTC](https://forum.kirupa.com/t/button-loses-its-rollover-functions/57790/3 "2004-07-16T12:37:18Z")

</div>

Thank you paradox, but unfortunatley it still loses the rollover functions. Is there a way to keep it a button and not an mc and add the same above functions?

Thanks 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:** [July 16, 2004, 5:52pm UTC](https://forum.kirupa.com/t/button-loses-its-rollover-functions/57790/4 "2004-07-16T17:52:18Z")

</div>

I think I misread what you were saying…  
This is what you have:  
mcWithAButtonInIt  
–buttonInTheMc

heres what the code should look like if the mc and button had those instance names  
on mcWithAButtonInIt put this:  
onClipEvent(load) {  
this.buttonInTheMc.onPress = this.buttonInTheMc.onRelease = function(){  
\_root.all\_stage.gotoAndStop(23);  
\_root.all\_stage.lb2\_stage.gotoAndPlay(2);  
}  
}  
if you want the press and release events to do something different from each other do this  
onClipEvent(load) {  
this.buttonInTheMc.onPress = function(){  
\_root.all\_stage.gotoAndStop(23);  
\_root.all\_stage.lb2\_stage.gotoAndPlay(2);  
}  
this.buttonInTheMc.onRelease = function(){  
//do some other stuff on release  
}  
}

That should do it, however, if it doesn’t, uploading your fla or emailing it to me at shawn[at]veuphoria[dot]com would probably be the fastest way to solve the problem

Good Luck,  
Shawn

---

<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:** [July 16, 2004, 7:07pm UTC](https://forum.kirupa.com/t/button-loses-its-rollover-functions/57790/5 "2004-07-16T19:07:41Z")

</div>

i think what you need is a hitTest. 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:** [July 16, 2004, 7:50pm UTC](https://forum.kirupa.com/t/button-loses-its-rollover-functions/57790/6 "2004-07-16T19:50:01Z")

</div>

The problem is that you cannot have nested on() events.  
As dru\_nasty suggested, hittest might be the option.

---

<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:** [July 19, 2004, 1:01pm UTC](https://forum.kirupa.com/t/button-loses-its-rollover-functions/57790/7 "2004-07-19T13:01:41Z")

</div>

Thanks guys. I was in such a crunch and then was away this weekend, so I just made a simple fix by turning the button into a movie clip and just advanced frames when it was roll-over-ed.  
I’ll just have to figure it out at a later point.

Thanks again!
