# \[F8\] Mouse position with function (.fla file attached)

**URL:** https://forum.kirupa.com/t/f8-mouse-position-with-function-fla-file-attached/251873
**Category:** flash
**Created:** [February 13, 2008, 1:25pm UTC](https://forum.kirupa.com/t/f8-mouse-position-with-function-fla-file-attached/251873 "2008-02-13T13:25:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![your\_syndrome](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@your\_syndrome](https://forum.kirupa.com/u/your_syndrome)
#### Post date: [February 13, 2008, 1:25pm UTC](https://forum.kirupa.com/t/f8-mouse-position-with-function-fla-file-attached/251873/1 "2008-02-13T13:25:09Z")

</div>

Hey there,

I’ve got a button called ‘HitArea’ and I’ve got some code (tween class) that when you roll over the ‘HitArea’ a small ball ‘ball\_mc’ goes to the mouse position, x and y.

```php

import mx.transitions.Tween; 
import mx.transitions.easing.*; 
 
HitArea.onRollOver = function() {   
    var gotoX = new Tween(ball_mc, "_x", Regular.easeOut, 20, _root._xmouse, 2, true); 
    var gotoy = new Tween(ball_mc, "_y", Regular.easeOut, 20, _root._ymouse, 2, true); 
} 

```

But it only goes to the initial place that the mouse rolls over the ‘HitArea’

I want the ‘ball\_mc’ to go to the mouse position when it rolls over ‘HitArea’ then the ‘ball\_mc’ would also follow the mouse around inside the ‘HitArea’

Any help would be great please ![](http://forum.kirupa.com/uploads/kirupa/1105/8ed432c9025fd9ca.gif)
