# rollOver-tween

**URL:** https://forum.kirupa.com/t/rollover-tween/23598
**Category:** flash
**Created:** [June 20, 2003, 12:26am UTC](https://forum.kirupa.com/t/rollover-tween/23598 "2003-06-20T00:26:30Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Neo\_Geo](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@Neo\_Geo](https://forum.kirupa.com/u/Neo_Geo)
#### Post date: [June 20, 2003, 12:26am UTC](https://forum.kirupa.com/t/rollover-tween/23598/1 "2003-06-20T00:26:30Z")

</div>

how to make this work?  
i have a mc that only half part of it visible on stage. the other half is outside. now i want it to tween with easing until all of the mc can be seen on stage when i place mymouse on top of it.

---

<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: [June 20, 2003, 12:59am UTC](https://forum.kirupa.com/t/rollover-tween/23598/2 "2003-06-20T00:59:07Z")

</div>

[http://www.kirupa.com/developer/mx/easing\_mouseclick.htm](http://www.kirupa.com/developer/mx/easing_mouseclick.htm)

It may not do the same thing, but the tutorial itself teaches the method of easing using the easing equation. So everything you need to know is in there.

---

<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: [June 20, 2003, 11:11am UTC](https://forum.kirupa.com/t/rollover-tween/23598/3 "2003-06-20T11:11:41Z")

</div>

thanks, that tutorial help. but can a movie clip move when we roll mouse on it. not when we press it. like in button - on (rollOver)

---

<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: [June 20, 2003, 11:55am UTC](https://forum.kirupa.com/t/rollover-tween/23598/4 "2003-06-20T11:55:56Z")

</div>

movieclipname.onRollOver = function() {  
actions go here  
}

---

<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: [June 20, 2003, 8:26pm UTC](https://forum.kirupa.com/t/rollover-tween/23598/5 "2003-06-20T20:26:57Z")

</div>

or on a frame…

[AS]targetClip.onEnterFrame = function(){  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, true){  
//ease to location onRollOver  
} else {  
//ease to location onRollOut (default location)  
}  
}[/AS]

You run the actions on enterFrame (basically constantly) and check if the mouse x and y position is over your clip, if it is, you ease it to the “out” position using the easing equation, else if it isn’t you ease it back to the original position using the easing equation.

Why hitTest()?

Simple… if you make the movie clip a button as sushis mentioned, you will not be able to have interactive content inside (ie: buttons, input text fields, sliders, or whatever else) because onRollOver converts it to sort of a button state, and you can’t have a button in a button because the main button will get the hit mouse state. hitTest() is a way to do onRollOver and onRollOut without using those actions so it doesn’t convert it to a button state.

---

<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: [June 20, 2003, 9:16pm UTC](https://forum.kirupa.com/t/rollover-tween/23598/6 "2003-06-20T21:16:58Z")

</div>

Thanks for the info, Lost. That will be helpful on the site I’m building 🙂

---

<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: [June 20, 2003, 9:21pm UTC](https://forum.kirupa.com/t/rollover-tween/23598/7 "2003-06-20T21:21:05Z")

</div>

No problem 🙂

hitTest is also used for other things (like in Flash games), but this seems to be one of the popular uses for it outside of game programming.
